代码之家  ›  专栏  ›  技术社区  ›  Arockia Prabakar

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

  •  0
  • Arockia Prabakar  · 技术社区  · 6 年前

    下面的请求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>
    

    相同的客户端存根代码将部署在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>  
    

    在上面的xml中 <asOfDate> 元素位置已更改。请帮助我们解决这个问题。

    1 回复  |  直到 6 年前
        1
  •  0
  •   Red Boy    6 年前

    您可能需要修改WSDL并创建模式 getPlanLookUpBySSN 元素,并重新生成客户端。比如下面。 标记使标记序列刚性。

    <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>