Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-694

Soap:Body is serialized inside of a soap:Header element

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 1.0
    • None
    • None
    • None
    • WinXP, JDK 1.5.06

    Description

      WSDL2Java -s -u -uri partner.wsdl

      compiled the generated code, called the query method which takes a session Header, like this
      SforceServiceStub stub = new SforceServiceStub();
      Login l = new Login();
      l.setUsername(args[0]);
      l.setPassword(args[1]);
      LoginResult lr = stub.login(l, null).getResult();

      System.out.println(lr.getServerUrl());
      System.out.println(lr.getSessionId());

      SessionHeader sh = new SessionHeader();
      sh.setSessionId(lr.getSessionId());
      stub = new SforceServiceStub(lr.getServerUrl().replace("https:", "http:"));

      Query q = new Query();
      q.setQueryString("select id, name, accountNumber from Account");
      QueryResult qr = stub.query(q, sh, null, null).getResult();
      System.out.println("Query return a total " + qr.getSize() + " rows");

      OMElement o = qr.getRecords()[0];
      Iterator i = o.getChildElements();
      while(i.hasNext())

      { OMElement c = (OMElement)i.next(); System.out.println(c.getLocalName() + " : " + c.getText()); }

      The call to query fails because the generated SOAP message has soap:Body inside of the soap:Header element

      POST /services/Soap/u/7.0 HTTP/1.1
      User-Agent: Axis/2.0
      SOAPAction: ""
      Host: na1-api.salesforce.com
      Transfer-Encoding: chunked
      Content-Type: text/xml; charset=UTF-8

      150
      <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header><soapenv:Body><ns1:query xmlns:ns1="urn:partner.soap.sforce.com"><ns1:queryString>select id, name, accountNumber from Account</ns1:queryString></ns1:query></soapenv:Body></soapenv:Header></soapenv:Envelope>
      0

      Attachments

        1. partner.wsdl
          85 kB
          Simon Fell

        Activity

          People

            ajith Ajith Ranabahu
            sfell@salesforce.com Simon Fell
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: