Java 通过SOAP将请求XML传递给调用webservice后请求XML中的更改

Java 通过SOAP将请求XML传递给调用webservice后请求XML中的更改,java,soap,axis,websphere-8,Java,Soap,Axis,Websphere 8,下面的请求xml可以由服务客户端存根代码形成,该代码在dev box中运行良好。应用服务器是websphere-8.5.5 <?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://ww

下面的请求xml可以由服务客户端存根代码形成,该代码在dev box中运行良好。应用服务器是websphere-8.5.5

<?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><getPlanLookUpBySSN xmlns="http://example.com"><argLookupBySSNInput xmlns=""><applicationId>IVR</applicationId><client>PC</client><ivrInd>Y</ivrInd><scrollIndicator></scrollIndicator><scrollKey></scrollKey><ssn>12345</ssn><type>Dental</type><userId>IVR</userId><asOfDate></asOfDate></argLookupBySSNInput></getPlanLookUpBySSN></soapenv:Body></soapenv:Envelope>
IVRPCY12345DentalIVR

相同的客户端存根代码将部署在UAT中。服务器(WebSphere)和服务URL与开发中的相同,但元素位置在UAT框中按字母顺序排序。因此,web服务不会接受请求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><getPlanLookUpBySSN xmlns="http://example.com"><argLookupBySSNInput xmlns=""><applicationId>IVR</applicationId><asOfDate></asOfDate><client>PC</client><ivrInd>Y</ivrInd><scrollIndicator></scrollIndicator><scrollKey></scrollKey><ssn>12345</ssn><type>Dental</type><userId>IVR</userId></argLookupBySSNInput></getPlanLookUpBySSN></soapenv:Body></soapenv:Envelope>  
IVRPCY12345DentalIVR

在上面的xml中,元素的位置已更改。请帮助我们解决此问题。

您可能需要修改WSDL,使模式GetPlanLookupBySN元素按如下固定顺序排列,然后重新生成客户端。像下面这样。 标记使标记序列刚性

<xs:element name="getPlanLookUpBySSN">
          <xs:complexType>
                 <xs:sequence>
                        <xs:element name="argLookupBySSNInput">
                               <xs:complexType>
                                      <xs:sequence>
                                             <xs:element name="applicationId" type="xs:string"></xs:element>
                                             <xs:element name="asOfDate"></xs:element>
                                             <xs:element name="client" type="xs:string"></xs:element>
                                             <xs:element name="ivrInd" type="xs:string"></xs:element>
                                             <xs:element name="scrollIndicator"></xs:element>
                                             <xs:element name="scrollKey"></xs:element>
                                             <xs:element name="ssn" type="xs:int"></xs:element>
                                             <xs:element name="type" type="xs:string"></xs:element>
                                             <xs:element name="userId" type="xs:string"></xs:element>
                                         </xs:sequence>
                                      <xs:attribute name="xmlns" type="xs:string"></xs:attribute>
                                  </xs:complexType>
                           </xs:element>
                    </xs:sequence>
                 <xs:attribute name="xmlns" type="xs:string"></xs:attribute>
             </xs:complexType>
      </xs:element>


共享用于上述流的xsd/wsdl?wsdl是机密信息,因此我们不会共享它。您必须在xsd/wsdl中维护序列,以便生成的请求按固定顺序进行。您是正确的@Rishal。在dev框中,生成的请求xml按固定顺序进行。但在UAT中,生成的xml并不是按固定顺序进行的。如果我们已经为websphere配置了任何东西,如果您知道的话,请与我分享。不确定您有什么样的soap服务,但这似乎很奇怪。我在jax-ws中看到的是,“arglookupbySSN”将完全转换为一个java对象,它不在乎顺序是什么。