1 Reply Latest reply on Jul 19, 2007 2:34 PM by Huj Weng

    contract based approach

    Huj Weng Newbie

      Is it possible to create a SOAP message with contract based approach as:

      javax.xml.soap.MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL).createMessage();
      

      I have tried but getting:
      does not contain operation meta data for

      error.

        • 1. Re: contract based approach
          Huj Weng Newbie

          Of course if I write the xml manually and send it over http like this:

          <?xml version=\"1.0\" ?>
           "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">
           "<soapenv:Body>
           "<ans:search xmlns:ans=\"http://ws.hj.org/\">
           "<arg0>test</arg0>
           "</ans:search>
           "</soapenv:Body>
           "</soapenv:Envelope>
          

          it works, but if you do:
           SOAPMessage msg = javax.xml.soap.MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL).createMessage();
           SOAPEnvelope env = msg.getSOAPPart().getEnvelope();
           SOAPBody body = env.getBody();
           SOAPBodyElement be = body.addBodyElement(env.createName("search", "", "ws.hj.org"));
           be.addChildElement("arg0").addTextNode("test");
          

          it produces and send different xml to endpoint which results in above mentioned exception