Web服务代理返回null

时间:2013-07-23 18:14:57

标签: c# wcf wsdl

这是我尝试连接的Web服务URL并使用其中的一些操作。 要使用的操作是RealTimeTransaction。 此方法接受输入Corerealtimerequest对象并返回CoreRealtimeResposne对象。 一切都很好。 Web服务返回一个SOAP响应,Fiddler能够捕获该响应,但代理返回null。

https://orserviceb2btest.oracleoutsourcing.com/soa-infra/services/default/MMISSOAPRequestReceiver!1.0*soa_d48cf4e0-5e7b-43ad-b430-727180d48841/RouteEDITransactions_ep?WSDL

此wsdl包含许多未解析的链接。当我将所有出现的b2borexatest更改为orseviceb2btest时,wsdl引用会解析。服务网址中共有4个对b2borexatest的引用。通过这样做,我能够使用svcutil创建代理类。

https://b2borexatest.oracleoutsourcing.com/soa-infra/services/default/MMISSOAPRequestReceiver!1.0/CORERule220.wsdl 
to
 https://orserviceb2btest.oracleoutsourcing.com/soa-infra/services/default/MMISSOAPRequestReceiver!1.0/CORERule220.wsdl

这就是wsdl

中定义这些对象的方式
<types>-<xsd:schema xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://www.caqh.org/SOAP/WSDL/" elementFormDefault="qualified">
<xsd:import schemaLocation="https://b2borexatest.oracleoutsourcing.com:443/soa-infra/services/default/MMISSOAPRequestReceiver!1.0*soa_d48cf4e0-5e7b-43ad-b430-727180d48841/RouteEDITransactions_ep?XSD=xsd/CORERule2.2.0.xsd" namespace="http://www.caqh.org/SOAP/WSDL/CORERule2.2.0.xsd"/>
    </xsd:schema>
    </types>-<message name="RealTimeRequestMessage">
    <part name="body" element="CORE-XSD:COREEnvelopeRealTimeRequest"/>
    </message>
    <message name="RealTimeResponseMessage">
    <part name="body" element="CORE-XSD:COREEnvelopeRealTimeResponse"/>
    </message>

这就是肥皂的一部分:Fiddler请求上的Body看起来像

`<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<COREEnvelopeRealTimeRequest xmlns="http://www.caqh.org/SOAP/WSDL/CORERule2.2.0.xsd">
<PayloadType xmlns="">X12_270_Request_005010X279A1</PayloadType>
<ProcessingMode xmlns="">RealTime</ProcessingMode><PayloadID xmlns="">461726944</PayloadID>
<TimeStamp xmlns="">2013-07-23T07:35:22Z</TimeStamp>
<SenderID xmlns="">SID</SenderID>
<ReceiverID xmlns="">RID</ReceiverID>
<CORERuleVersion xmlns="">`

来自Soap UI或Fiddler的回应。 我对COreRealtimResponse感兴趣的对象。  当我使用代理调用服务方法时,这个为null。

      HTTP/1.1 200 OK
        Date: Fri, 19 Jul 2013 21:10:32 GMT
        Server: Oracle-Application-Server-11g
        Content-Length: 3030
        Set-Cookie: JSESSIONID=; expires=Thu, 01-Jan-1970 01:00:00 GMT; path=/; HttpOnly
        Set-Cookie: _WL_AUTHCOOKIE_JSESSIONID=; expires=Thu, 01-Jan-1970 01:00:00 GMT; path=/; secure; HttpOnly
        X-ORACLE-DMS-ECID: 004sUF1pzHw9PdyN06aAUF00037x000S4e
        SOAPAction: ""
        X-Powered-By: Servlet/2.5 JSP/2.1
        Keep-Alive: timeout=5, max=100
        Connection: Keep-Alive
        Content-Type: multipart/related;type="application/xop+xml";boundary="----=_Part_52_444854407.1374268236586";start="<283134dc77544061b8c4d5788ee9bd44>";start-info="text/xml"
        Content-Language: en

        ------=_Part_52_444854407.1374268236586
        Content-Type: application/xop+xml;charset=UTF-8;type="text/xml"
        Content-Transfer-Encoding: 8bit
        Content-ID: <283134dc77544061b8c4d5788ee9bd44>

        <?xml version="1.0" encoding="UTF-8" ?>
      <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" <env:Body>
<COREEnvelopeRealTimeResponse xmlns:cor="http://www.caqh.org/SOAP/WSDL/CORERule2.2.0.xsd" xmlns="http://www.caqh.org/SOAP/WSDL/CORERule2.2.0.xsd"><cor:PayloadType>X12_271_Response_005010X279A1</cor:PayloadType><cor:ProcessingMode>RealTime</cor:ProcessingMode>
    <cor:PayloadID>339408072</cor:PayloadID>
    <cor:TimeStamp>2013-07-19T16:10:36.517-05:00</cor:TimeStamp>
    <cor:SenderID>SID</cor:SenderID>
    <cor:ReceiverID>RECID</cor:ReceiverID>
    <cor:CORERuleVersion>2.2.0</cor:CORERuleVersion>
    <cor:Payload>ISA*00*          *00*          ~</cor:Payload>
    <cor:ErrorCode>Successful</cor:ErrorCode>
    <cor:ErrorMessage>Envelope was processed successfully</cor:ErrorMessage>
</COREEnvelopeRealTimeResponse>
</env:Body>
</env:Envelope>
        ------=_Part_52_444854407.1374268236586--

代码:

 var ORrealTimeTrans = new ORMCDProxy.COREEnvelopeRealTimeRequest()
            {
                PayloadType = "X12_270_Request_005010X279A1",
                ProcessingMode = procMode,
                PayloadID = InterchangeControlNumber,
                CORERuleVersion = ruleVersion,
                SenderID = senderId,
                ReceiverID = receiverId,
                TimeStamp = DateTime.UtcNow.ToString("yyyy-MM-ddThh:mm:22Z"),
                Payload = Query270
            };

 ORMCDProxy.COREEnvelopeRealTimeResponse resp = ORMCDProxy.RealTimeTransaction(ORrealTimeTrans);

此resp对象为null。

http://webservices20.blogspot.com/2008/10/interoperability-gotcha-visual-studio.html记录问题,解决方案是添加Web引用而不是服务引用。

但这不是我的选择,因为服务wsdl有未解析的链接,我无法控制它。

0 个答案:

没有答案