Subject Re: Issue w/SOAP Calls utilizing document style binding
From Dolores <dbroder@nycourts.gov>
Date Thu, 23 Jan 2020 12:01:46 -0500
Newsgroups xb2net
Attachment(s) soapenvelope.txt

Boris Borzic <bb> Wrote:

> D Broder <dbroder@nycourts.gov> wrote in
> news:4mp6st6bazvuryl.151120190851@BACKUP:
>
> > We are performing a server upgrade and ran into an issue with SOAP
> > Calls utilizing document style binding. We are currently using Xbase++
> > 1.90.355 and XB2NET 3.6.05.  The SOAP envelope that is generated by
> > XB2NET includes an extra wrapper element in the SOAP body.  The old
> > server was able to handle this extra element however the new server
> > rejects the SOAP request as it doesn\\\'t match the WSDL.  We believe
> > this is because the old server\\\'s version of cxf was more lenient.
> >
> > In order to remedy the issue we updated some the attributes of SOAP
> > envelope in what feels like a kludge to get the desired envelope.  
> >
> > I\\\'ve included the wsdl, the original and updated code used to produce
> > the xbSOAPEnvelope as well as the output from soap:asString() and the
> > envlope captured from WireShark.
>
> Why are there backslashes everywhere in your posting? Are these supposed to
> be there? It makes is difficult to read the code.
>
> I wanted to let you know that if you already know the format of the final
> XML string, you can simply create the string (with your data inserted),
> then supply the final XML string in the 4th param of
> xbSoapEnvelope:execute() method.
>
> --
> Best regards,
> Boris Borzic
>
> http://xb2.net
> http://sqlexpress.net
> industrial strength Xbase++ development tools


Boris -
Thanks for the suggestion to create the XML string.  We would like to stay away from formatting the xml ourselves and would rather have the xml be generated by xb2net via xbSOAPEnvelope objects.

I've attached a text file with the code to generate the xbSOAPEnvelope object.  Please review and let me know if we are creating the objects correctly.

Thank you -
Dolores



* The desired SOAP Envelope based on the WSDL (created by SOAPUI) for the Authenticate request is as follows:
      <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
         <soapenv:Header/>
         <soapenv:Body>
            <ser:CredentialData xsi:type="ser:CredentialData" xmlns:ser="https://some.name.space/wsdl/Service.wsdl">
               <UserName xsi:type="xsd:string">?</UserName>
               <Password xsi:type="xsd:string">?</Password>
            </ser:CredentialData>
         </soapenv:Body>
      </soapenv:Envelope>


* This code works on the new TomEE server (not on the old JBoss server)
        oSoap := xbSOAPEnvelope():new()
        oSoap:KeepAlive(.T.)  
        oSoap:CharacterEncoding := "UTF-8"
        oSoap:Transport := VIA_WININET
        oSoap:NameSpace := SERVICE_NAME_SPACE
        oSoap:SetStyle(SOAP_STYLE_DOCUMENT,SOAP_BINDING_LITERAL)
        oSoap:AddNameSpace('ser="' + SERVICE_NAME_SPACE + '"')
        oSoap:NameSpace := '""'
        oSoap:AddVar("UserName", trim(cUserName))
        oSoap:AddVar("Password", trim(cPassword))
        oRet := oSoap:Execute(URL, "ser:CredentialData", "Authenticate")

      asString()
      <env:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
                    xmlns:ser="https://some.name.space/wsdl/Service.wsdl" >
        <env:Body>
          < xmlns="">
            <UserName>sdfsdfsd</UserName>
            <Password>sfdsdfsdfs</Password>
          </>
        </env:Body>
      </env:Envelope>

      WireShark:
      From WireShark:
      <env:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
                    xmlns:ser="https://some.name.space/wsdl/Service.wsdl" >
        <env:Body>
          <ser:CredentialData xmlns="">
            <UserName>sdfsdfsd</UserName>
            <Password>sfdsdfsdfs</Password>
          </ser:CredentialData>
        </env:Body>
      </env:Envelope>


* Original code used to generate SOAP Envelope adds a "m:" wrapper element in the soap body
        This works on the JBoss server but fails on the TomEE server with the following error:
          org.apache.cxf.interceptor.Fault: Unexpected element {https://some.name.space/wsdl/Service.wsdl}Operations found.
                                            Expected {https://some.name.space/wsdl/Service.wsdl}CredentialData.

        oSoap := xbSOAPEnvelope():new()
        oSoap:KeepAlive(.T.)  
        oSoap:CharacterEncoding := "UTF-8"
        oSoap:Transport := VIA_WININET
        oSoap:NameSpace := SERVICE_NAME_SPACE
        oSoap:AddVar("UserName", trim(cUserName))
        oSoap:AddVar("Password", trim(cPassword))
        oRet := oSoap:Execute(URL, "Operations", "Authenticate")
  
        oSoap:asString()
        <env:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                      xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
                      xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
                      xmlns:xs="http://www.w3.org/2001/XMLSchema"
                      env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
          <env:Body>
            <m:Operations xmlns:m="https://some.name.space/wsdl/Service.wsdl">
              <UserName xsi:type="xs:string">sdfsfsdfsd</UserName>
              <Password xsi:type="xs:string">sdfsdfdfsd</Password>
            </m:Operations>
          </env:Body>
        </env:Envelope>

        WireShark:
        <env:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                      xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
                      xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
                      xmlns:xs="http://www.w3.org/2001/XMLSchema"
                      env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
          <env:Body>
            <m:Operations xmlns:m="https://some.name.space/wsdl/Service.wsdl">
              <UserName xsi:type="xs:string">sdfsfsdfsd</UserName>
              <Password xsi:type="xs:string">sdfsdfdfsd</Password>
            </m:Operations>
          </env:Body>
        </env:Envelope>





Recent messages in this thread
 
-# Issue w/SOAP Calls utilizing document style binding D Broder 15-Nov-2019 08:51 am
.-# Re: Issue w/SOAP Calls utilizing document style binding Boris Borzic <bb> 15-Nov-2019 05:12 pm
..\# Re: Issue w/SOAP Calls utilizing document style binding (Current message) Dolores 23-Jan-2020 12:01 pm