Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从.Net问题使用AXIS Web服务_.net_Wcf_Web Services_Asmx_Axis - Fatal编程技术网

从.Net问题使用AXIS Web服务

从.Net问题使用AXIS Web服务,.net,wcf,web-services,asmx,axis,.net,Wcf,Web Services,Asmx,Axis,我在客户端C#web应用程序中使用axis(JAVA)web服务时遇到问题。我必须使用第三方web服务,它可以与JAVA客户机正常工作!当我们用SoapUI测试它时,它工作得非常好。 我添加了web服务和服务引用(asmx和wcf),但两个引用的工作原理相同!我认为wsdl.exe(reference.cs)生成的代码有问题 因为它无法反序列化从服务器备份的响应。 我可以在调试模式下看到SOAP响应,我知道响应是正确的。但在反序列化过程开始时,出现异常“XML文档格式不正确!”,“根命名空间丢失

我在客户端C#web应用程序中使用axis(JAVA)web服务时遇到问题。我必须使用第三方web服务,它可以与JAVA客户机正常工作!当我们用SoapUI测试它时,它工作得非常好。 我添加了web服务和服务引用(asmx和wcf),但两个引用的工作原理相同!我认为wsdl.exe(reference.cs)生成的代码有问题 因为它无法反序列化从服务器备份的响应。 我可以在调试模式下看到SOAP响应,我知道响应是正确的。但在反序列化过程开始时,出现异常“XML文档格式不正确!”,“根命名空间丢失”

响应:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <processRequestResponse xmlns="http://www.mytown.com">
      <ETIResponse xmlns="">
        <ns1:TransactionID xmlns:ns1="http://www.mytown.com">CDK11341818404883</ns1:TransactionID>
        <ns2:OrigResponseMessage xmlns:ns2="http://www.mytown.com">.....</ns2:OrigResponseMessage>
        <ns3:CommandStatus xmlns:ns3="http://www.mytown.com">INVALID</ns3:CommandStatus>
        <ns4:ResultCode xmlns:ns4="http://www.mytown.com">21</ns4:ResultCode>
      </ETIResponse>
    </processRequestResponse>
  </soapenv:Body>
</soapenv:Envelope>
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://www.mytown.com" 
                  xmlns:apachesoap="http://xml.apache.org/xml-soap" 
                  xmlns:impl="http://www.mytown.com" 
                  xmlns:intf="http://www.mytown.com" 
                  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
                  xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" 
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <wsdl:types>
    <schema targetNamespace="http://www.mytown.com" xmlns="http://www.w3.org/2001/XMLSchema">
      <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
      <complexType name="ETIParameter">
        <sequence>
          <element name="key" nillable="true" type="xsd:string"/>
          <element name="value" nillable="true" type="xsd:string"/>
        </sequence>
      </complexType>
      <complexType name="ETIParameters">
        <sequence>
          <element maxOccurs="unbounded" minOccurs="0" name="Parameter" nillable="true" type="impl:ETIParameter"/>
        </sequence>
      </complexType>
      <complexType name="ETIRequestType">
        <sequence>
          <element name="RequestMessage" nillable="true" type="xsd:string"/>
          <element name="ClientID" nillable="true" type="xsd:string"/>
          <element name="Password" nillable="true" type="xsd:string"/>
          <element maxOccurs="1" minOccurs="0" name="Parameters" nillable="true" type="impl:ETIParameters"/>
        </sequence>
      </complexType>
      <simpleType name="CommandStatusType">
        <restriction base="xsd:string">
          <enumeration value="OK"/>
          <enumeration value="SYSTEM-ERROR"/>
          <enumeration value="SYNTAX-ERROR"/>
          <enumeration value="INVALID"/>
          <enumeration value="ERROR"/>
        </restriction>
      </simpleType>
      <complexType name="ETIResponseType">
        <sequence>
          <element maxOccurs="1" minOccurs="0" name="TransactionID" nillable="true" type="xsd:string"/>
          <element name="OrigResponseMessage" nillable="true" type="xsd:string"/>
          <element maxOccurs="1" minOccurs="0" name="TermResponseMessage" nillable="true" type="xsd:string"/>
          <element name="CommandStatus" nillable="true" type="impl:CommandStatusType"/>
          <element name="ResultCode" type="xsd:int"/>
          <element maxOccurs="1" minOccurs="0" name="ErrorMsg" nillable="true" type="xsd:string"/>
        </sequence>
      </complexType>
    </schema>
  </wsdl:types>
  <wsdl:message name="processRequestRequest">
    <wsdl:part name="ETIRequest" type="impl:ETIRequestType"/>
  </wsdl:message>
  <wsdl:message name="processRequestResponse">
    <wsdl:part name="ETIResponse" type="impl:ETIResponseType"/>
  </wsdl:message>
  <wsdl:portType name="ETI_Type">
    <wsdl:operation name="processRequest" parameterOrder="ETIRequest">
      <wsdl:input message="impl:processRequestRequest" name="processRequestRequest"/>
      <wsdl:output message="impl:processRequestResponse" name="processRequestResponse"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="ETICoreSoapBinding" type="impl:ETI_Type">
    <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="processRequest">
      <wsdlsoap:operation soapAction="capeconnect:ETI_WebService:ETI_Type#processRequest"/>
      <wsdl:input name="processRequestRequest">
        <wsdlsoap:body namespace="http://www.mytown.com" use="literal"/>
      </wsdl:input>
      <wsdl:output name="processRequestResponse">
        <wsdlsoap:body namespace="http://www.mytown.com" use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="ETI_WebService">
    <wsdl:port binding="impl:ETICoreSoapBinding" name="ETICore">
      <wsdlsoap:address location="https://X.X.X.X/banks/services/ETICore"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>
有什么意见或帮助吗


谢谢

根据XSD/WSDL,我认为响应无效。这就是问题所在:

<ETIResponse xmlns="">...</ETIResponse>
。。。
此元素未声明默认前缀的命名空间,但:

  • WSDL本身将目标命名空间声明为,因此应该使用它
  • 具有的父元素已使用默认命名空间
您需要摆脱
xmlns=“”
或使用
xmlns=”http://www.mytown.com“
。尝试使用拦截响应并更改它,以便检查它是否真的有效


如果是这样,请要求Java开发人员修改他们的服务,使其返回有效的响应;如果是ASMX,请实现自定义
SoapExtension
;如果是WCF,请实现自定义
IClientMessageInspector
,并重新格式化消息

嗨。谢谢你的回复。我已经在我的问题之前实现了customesope扩展,以便在流程上进行堆栈。同样的错误也存在。在这两种情况下,我有相同的错误!经过大量的工作!问题终于解决了。我已经为asmx和IClientMessageInspector测试了SOAPExtension。我更喜欢将ETIResponse成员的“Form=System.Xml.Schema.XmlSchemaForm.Unqualified”更改为“Qualified”。。
There was an error in serializing body of message : 'There was an error generating the XML document.'.  Please see InnerException for more details.
The prefix '' is bound to the namespace '' and cannot be changed to 'http://www.mytown.com'.
<ETIResponse xmlns="">...</ETIResponse>