1 Reply Latest reply on Apr 18, 2008 4:25 AM by Richard Opalka

    How to prefix a SOAP Message with a Processing Instruction?

    Barry Sheward Newbie

      Hi,

      I have a very simple piece of code to invoke a web service:

      ReService service = new ReService();
      RePortType re = service.getRePort();
      results = re.getReResult( query, username, password);
      


      It results in the following SOAP message being posted:

      <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
       <env:Header/>
       <env:Body>
       <GetRelevanceResult xmlns='http://myns'>
       <reExpr>select * from tbl</reExpr>
       <username>user</username>
       <password>xxxxxxxx</password>
       </GetRelevanceResult>
       </env:Body>
      </env:Envelope>
      


      The problem is that this request is rejected by the server. However, when I prefix the SOAP message with a processing instruction, the server responds correctly:

      <?xml version="1.0" encoding="UTF-8"?>
      <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
       <env:Header/>
       <env:Body>
       <GetRelevanceResult xmlns='http://myns'>
       <reExpr>select * from tbl</reExpr>
       <username>user</username>
       <password>xxxxxxxx</password>
       </GetRelevanceResult>
       </env:Body>
      </env:Envelope>
      


      (I tested this theory using SOAP UI (http://www.soapui.org/))

      My question is, what is the best way, to prefix the processing instruction to the SOAP message?

      Are HandlerChains the right way to go?

      Are there any examples of this type of message manipulation?

      Thanks and Regards,

      Barry