You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by Benjamin Schmeling <Be...@gmx.de> on 2006/05/10 11:15:45 UTC

Sending a custom SOAP message with Sandesha2

Hi,

I want to write a Web Service which sends reliable SOAP messages with 
Sandesha2. My input is a SOAP message as String. The problem is that I 
do not know how to transform this into an OMElement that can be sent 
with the ServiceClient class.

I tried something like this but it did not work:

String soap = "....";
ByteArrayInputStream inStr = new ByteArrayInputStream(soap.getBytes());
SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
OMXMLParserWrapper parser = 
OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac, 
XMLInputFactory.newInstance().createXMLStreamReader(inStr));
client.sendReceive(fac.createSOAPEnvelope(parser));

How can I get this working?

Thanks,

Benjamin


---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org


Re: Sending a custom SOAP message with Sandesha2

Posted by Benjamin Schmeling <Be...@gmx.de>.
I checked it with all combination with the result that only the last one 
causes the error. Now this SOAP message was taken from a SOAP message 
sent by Axis1. Is it not compatible?
> Seems like there are three key things different when you create the 
> SOAP message.
>
> 1) Its using SOAP Encoding which is not WS-I compliant. I don't think 
> Axis2 supports SOAP encoding
> 2) The namespace on the Message element is empty.
> 3) There is an xsi:type attribute.
>
> My hunch is that the problem is caused by #1. Can you try the 
> combinations?
>
> Paul
>
> On 5/12/06, *Benjamin Schmeling * <Benjamin_Schmeling@gmx.de 
> <ma...@gmx.de>> wrote:
>
>     The TCP Monitor shows that there is a Create Sequence message and the
>     Sequence message which is sent several times.
>     I compared the messages, when I do the sending with the common
>     mechanism
>     and the one which is not working:
>
>     Not working (When I do it with a custom SOAP message):
>
>     <?xml version='1.0' encoding='UTF-8'?>
>         <soapenv:Envelope
>             xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope/"
>             xmlns:wsa="http://www.w3.org/2005/08/addressing">
>             <soapenv:Header>
>                 <wsa:To>
>                     http://localhost:8080/axis2/services/TestWebservice
>                 </wsa:To>
>                 <wsa:ReplyTo>
>                     <wsa:Address>
>
>     http://192.168.2.28:6060/axis2/services/__ANONYMOUS_SERVICE__/__OPERATION_OUT_IN__
>                     </wsa:Address>
>                 </wsa:ReplyTo>
>                 <wsa:MessageID>
>                     urn:uuid:1D1AD9A62C5E91BDA111474329524691
>                 </wsa:MessageID>
>                 <wsa:Action>testWS1</wsa:Action>
>                 <wsrm:Sequence
>                     xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm"
>                     soapenv:mustUnderstand="1">
>                     <wsrm:Identifier>
>                         urn:uuid:586A806EA5B897625C11474329535803
>                     </wsrm:Identifier>
>                     <wsrm:MessageNumber>1</wsrm:MessageNumber>
>                     <wsrm:LastMessage />
>                 </wsrm:Sequence>
>             </soapenv:Header>
>             <soapenv:Body>
>                 <ns1:testWS1
>
>     xmlns:ns1=" http://localhost:8080/axis2/services/TestWebservice"
>
>     soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
>                     <message xsi:type="xsd:string">test</message>
>                 </ns1:testWS1>
>             </soapenv:Body>
>         </soapenv:Envelope>
>
>     working (this is produced when I do it like in the common examples):
>
>     <soapenv:Envelope
>             xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope/"
>             xmlns:wsa="http://www.w3.org/2005/08/addressing">
>             <soapenv:Header>
>                 <wsa:To>
>                     http://localhost:8080/axis2/services/TestWebservice
>                 </wsa:To>
>                 <wsa:ReplyTo>
>                     <wsa:Address>
>
>     http://192.168.2.28:6060/axis2/services/__ANONYMOUS_SERVICE__/__OPERATION_OUT_IN__
>     <http://192.168.2.28:6060/axis2/services/__ANONYMOUS_SERVICE__/__OPERATION_OUT_IN__>
>                     </wsa:Address>
>                 </wsa:ReplyTo>
>                 <wsa:MessageID>
>                     urn:uuid:A85BC3699C62F1BE9C11474295481541
>                 </wsa:MessageID>
>                 <wsa:Action>testWS1</wsa:Action>
>                 <wsrm:Sequence
>                     xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm"
>                     soapenv:mustUnderstand="1">
>                     <wsrm:Identifier>
>                         urn:uuid:F2318FAB2CF9BB22C211474295494053
>                     </wsrm:Identifier>
>                     <wsrm:MessageNumber>1</wsrm:MessageNumber>
>                     <wsrm:LastMessage />
>                 </wsrm:Sequence>
>             </soapenv:Header>
>             <soapenv:Body>
>                 <TestWebservice:testWS1
>
>     xmlns:TestWebservice="
>     http://localhost:8080/axis2/services/TestWebservice">
>                     <TestWebservice:message>Text</TestWebservice:message>
>                 </TestWebservice:testWS1>
>             </soapenv:Body>
>         </soapenv:Envelope>
>     > Have you tried using the TCPMon to see the message passing through?
>     >
>     > Paul
>     >
>     > On 5/12/06, *Benjamin Schmeling* < Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     > <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>> wrote:
>     >
>     >     Okay,
>     >
>     >     This is the SOAP message:
>     >
>     >     <?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'
>     >     xmlns:wsrm=' http://schemas.xmlsoap.org/ws/2005/02/rm
>     >     <http://schemas.xmlsoap.org/ws/2005/02/rm>'
>     >     xmlns:wsa=' http://schemas.xmlsoap.org/ws/2004/08/addressing'
>     >     <http://schemas.xmlsoap.org/ws/2004/08/addressing%27>>
>     >        <soapenv:Body>
>     >            <ns1:testWS1
>     >     soapenv:encodingStyle='
>     http://schemas.xmlsoap.org/soap/encoding/'
>     >     xmlns:ns1='TestWebservice'>
>     >                <message xsi:type='xsd:string'
>     xmlns=''>test</message>
>     >            </ns1:testWS1>
>     >        </soapenv:Body>
>     >     </soapenv:Envelope>
>     >
>     >     My code looks like this now and the exception is not thrown
>     >     anymore, but
>     >     nevertheless there is no message sent; but an error (12 Mai 2006
>     >     11:32:53,329  INFO AxisEngine:527 - Received Error Message
>     with id
>     >     null):
>     >
>     >     OMElement payload = getPayload(message);
>     >     OMElement omReturn = client.sendReceive(payload);
>     >
>     >     private OMElement getPayload(String soap) throws
>     >     FactoryConfigurationError, IOException, XMLStreamException,
>     >     SAXException, ParserConfigurationException{
>     >             ByteArrayInputStream inStr = new
>     >     ByteArrayInputStream(soap.getBytes());
>     >             SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
>     >             StAXSOAPModelBuilder builder =
>     >    
>     OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     >             SOAPEnvelope env = builder.getSOAPEnvelope();
>     >             return (OMElement) env.getBody().getFirstOMChild();
>     >     }
>     >
>     >     Maybe my axis2 is misconfigured? When I send a simple
>     message like in
>     >     the examples this works but in the server I always got that
>     pn the
>     >     logs:
>     >
>     >     - I/O exception (java.net.ConnectException) caught when
>     processing
>     >     request: Connection refused: connect
>     >     - Retrying request
>     >     - I/O exception (java.net.ConnectException ) caught when
>     processing
>     >     request: Connection refused: connect
>     >     - Retrying request
>     >     ....
>     >
>     >     I am using Sandesha2-1.0 and Axis2-1.0.
>     >
>     >     Thanks,
>     >
>     >     Benjamin
>     >     > Hi Benajamin,
>     >     >
>     >     > There is not sendReveive method that takes a SOAP envelope
>     as the
>     >     > parameter. Instead what you should give is the payload of
>     your SOAP
>     >     > envelope. If you want to add headers there is a seperate
>     >     'adddHeader'
>     >     > method available.
>     >     >
>     >     > If you are still getting the error, please send your full
>     client
>     >     code
>     >     > and the String u use to generate the SOAP envelope, for me to
>     >     > reproduce the error.
>     >     >
>     >     >
>     >     > Chamikara
>     >     >
>     >     >
>     >     > On 5/11/06, *Benjamin Schmeling*
>     <Benjamin_Schmeling@gmx.de <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de> >
>     >     > <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>>> wrote:
>     >     >
>     >     >     Sorry my fault my code looks like this:
>     >     >
>     >     >     ByteArrayInputStream inStr = new
>     >     >     ByteArrayInputStream(soap.getBytes());
>     >     >     SOAPFactory fac =   OMAbstractFactory.getSOAP11Factory();
>     >     >     StAXSOAPModelBuilder builder =
>     >     >     OMXMLBuilderFactory.createStAXSOAPModelBuilder
>     >     >
>     >    
>     (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     >     >
>     >     >     SOAPEnvelope env = builder.getSOAPEnvelope();
>     >     >     OMElement omReturn = client.sendReceive(env);
>     >     >
>     >     >     But the same error like before...
>     >     >     > Hi Benajamin,
>     >     >     >
>     >     >     > As I gave in my previous code example dont use the line
>     >     >     > fac.createSOAPEnvelope (parser) to build the SOAP
>     envelope.
>     >     >     >
>     >     >     > Use the method 'getSOAPEnvelope' of the
>     StAXSOAPModelBuilder,
>     >     >     > Here it is again,
>     >     >     >
>     >     >     > String soap = "....";
>     >     >     > ByteArrayInputStream inStr = new
>     >     >     ByteArrayInputStream(soap.getBytes());
>     >     >     > SOAPFactory fac =  
>     OMAbstractFactory.getSOAP11Factory();
>     >     >     > StAXSOAPModelBuilder builder =
>     >     >     > OMXMLBuilderFactory.createStAXSOAPModelBuilder
>     >     >     >
>     >     >     >
>     >    
>     (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     >     >     > SOAPEnvelope env = builder.getSOAPEnvelope();
>     >     >     > client.sendReceive(env );
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >     > Chamikara
>     >     >     >
>     >     >     >
>     >     >     > On 5/11/06, *Benjamin Schmeling*
>     >     <Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de> <mailto:
>     Benjamin_Schmeling@gmx.de <ma...@gmx.de>>
>     >     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>>
>     >     >     > <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>
>     >     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>>>> wrote:
>     >     >     >
>     >     >     >     Hi,
>     >     >     >
>     >     >     >     String soap = "....";
>     >     >     >     ByteArrayInputStream inStr = new
>     >     >     >     ByteArrayInputStream( soap.getBytes ());
>     >     >     >     SOAPFactory fac =  
>     OMAbstractFactory.getSOAP11Factory();
>     >     >     >     StAXSOAPModelBuilder builder =
>     >     >     >     OMXMLBuilderFactory.createStAXSOAPModelBuilder
>     >     >     >
>     >     >
>     >    
>     (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     >     >     >     SOAPEnvelope env = builder.getSOAPEnvelope();
>     >     >     >     client.sendReceive(fac.createSOAPEnvelope (parser));
>     >     >     >
>     >     >     >     the last line throws the following exception:
>     >     >     >
>     >     >     >     org.apache.axiom.om.OMException : Root Element
>     can not be
>     >     >     detached
>     >     >     >         at
>     >     >     >
>     >     >
>     >    
>     org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.detach(SOAPEnvelopeImpl.java
>     :155)
>     >     >     >         at
>     >     >     >     org.apache.axiom.om.impl.llom.OMNodeImpl.setParent
>     >     >     >     (OMNodeImpl.java :117)
>     >     >     >         at
>     >     >     >
>     >     >
>     >    
>     org.apache.axiom.soap.impl.llom.SOAPElement.setParent(SOAPElement.java:74)
>     >     >     >         at
>     >     >     >    
>     org.apache.axiom.om.impl.llom.OMElementImpl.addChild
>     >     >     (OMElementImpl.java:240)
>     >     >     >         at
>     >     >     >     org.apache.axiom.om.impl.llom.OMElementImpl.addChild
>     >     >     >     (OMElementImpl.java:197)
>     >     >     >         at
>     >     >     >    
>     org.apache.axis2.client.ServiceClient.fillSoapEnvelope
>     >     >     (ServiceClient.java:554)
>     >     >     >         at
>     >     >     >
>     >     >
>     >    
>     org.apache.axis2.client.ServiceClient.sendReceiveNonBlocking(ServiceClient.java
>     >     :467)
>     >     >     >         at
>     >     >     >     org.apache.axis2.client.ServiceClient.sendReceive
>     >     >     (ServiceClient.java:411)
>     >     >     >         at
>     >     >     >
>     >     >     org.apache.axis2.client.ServiceClient.sendReceive
>     >     (ServiceClient.java:394)
>     >     >     >
>     >     >     >     What does this mean?
>     >     >     >     > Hi Benjamin,
>     >     >     >     >
>     >     >     >     > Try following,
>     >     >     >     >
>     >     >     >     > String soap = "....";
>     >     >     >     > ByteArrayInputStream inStr = new
>     >     >     >     ByteArrayInputStream(soap.getBytes());
>     >     >     >     > SOAPFactory fac =
>     >     OMAbstractFactory.getSOAP11Factory();
>     >     >     >     > StAXSOAPModelBuilder builder =
>     >     >     >     >
>     >     >     >
>     >     >
>     >     OMXMLBuilderFactory.createStAXSOAPModelBuilder
>     (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     >     >
>     >     >     >     > SOAPEnvelope env = builder.getSOAPEnvelope();
>     >     >     >     >
>     >     >     >     >
>     >     >     >     >
>     >     >     >     > Chamikara
>     >     >     >     >
>     >     >     >     >
>     >     >     >     >
>     >     >     >     > On 5/10/06, *Benjamin Schmeling* <
>     >     >     Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     <mailto:Benjamin_Schmeling@gmx.de <ma...@gmx.de>>
>     >     <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     <mailto:Benjamin_Schmeling@gmx.de <ma...@gmx.de>>>
>     >     >     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>
>     >     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>>>
>     >     >     >     > <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>
>     >     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>>
>     >     >     >     <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>
>     >     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>>>>> wrote:
>     >     >     >     >
>     >     >     >     >     Hi,
>     >     >     >     >
>     >     >     >     >     I want to write a Web Service which sends
>     >     reliable SOAP
>     >     >     >     messages with
>     >     >     >     >     Sandesha2. My input is a SOAP message as
>     String.
>     >     The
>     >     >     problem
>     >     >     >     is that I
>     >     >     >     >     do not know how to transform this into an
>     OMElement
>     >     >     that can
>     >     >     >     be sent
>     >     >     >     >     with the ServiceClient class.
>     >     >     >     >
>     >     >     >     >     I tried something like this but it did not
>     work:
>     >     >     >     >
>     >     >     >     >     String soap = "....";
>     >     >     >     >     ByteArrayInputStream inStr = new
>     >     >     >     >     ByteArrayInputStream( soap.getBytes());
>     >     >     >     >     SOAPFactory fac =
>     >     OMAbstractFactory.getSOAP11Factory();
>     >     >     >     >     OMXMLParserWrapper parser =
>     >     >     >     >    
>     OMXMLBuilderFactory.createStAXSOAPModelBuilder (fac,
>     >     >     >     >     XMLInputFactory.newInstance
>     >     >     ().createXMLStreamReader(inStr));
>     >     >     >     >     client.sendReceive (fac.createSOAPEnvelope
>     (parser));
>     >     >     >     >
>     >     >     >     >     How can I get this working?
>     >     >     >     >
>     >     >     >     >     Thanks,
>     >     >     >     >
>     >     >     >     >     Benjamin
>     >     >     >     >
>     >     >     >     >
>     >     >     >     >
>     >     >     >
>     >     >
>     >    
>     ---------------------------------------------------------------------
>     >     >     >     >     To unsubscribe, e-mail:
>     >     >     >     sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>>
>     >     >     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>>>
>     >     >     >     >     <mailto:
>     sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>>
>     >     >     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>>>>
>     >     >     >     >     For additional commands, e-mail:
>     >     >     >     sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>>
>     >     >     >     <mailto: sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>>>
>     >     >     >     >     <mailto: sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto: sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>>
>     >     >     >     <mailto: sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto: sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>>>>
>     >     >     >     >
>     >     >     >     >
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >
>     >     >
>     >     >
>     >
>     >
>     >
>     >    
>     ---------------------------------------------------------------------
>     >     To unsubscribe, e-mail:
>     sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     For additional commands, e-mail:
>     sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>
>     >
>     >
>     >
>     >
>     > --
>     > Paul Fremantle
>     > VP/Technology, WSO2 and OASIS WS-RX TC Co-chair
>     >
>     > http://bloglines.com/blog/paulfremantle
>     <http://bloglines.com/blog/paulfremantle>
>     > paul@wso2.com <ma...@wso2.com> <mailto:paul@wso2.com
>     <ma...@wso2.com>>
>     >
>     > "Oxygenating the Web Service Platform", www.wso2.com
>     <http://www.wso2.com> <http://www.wso2.com>
>
>
>
>
>
> -- 
> Paul Fremantle
> VP/Technology, WSO2 and OASIS WS-RX TC Co-chair
>
> http://bloglines.com/blog/paulfremantle
> paul@wso2.com <ma...@wso2.com>
>
> "Oxygenating the Web Service Platform", www.wso2.com <http://www.wso2.com>



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org


Re: Sending a custom SOAP message with Sandesha2

Posted by Benjamin Schmeling <Be...@gmx.de>.
I checked it with all combination with the result that only the last one 
causes the error. Now this SOAP message was taken from a SOAP message 
sent by Axis1. Is it not compatible?
> Seems like there are three key things different when you create the 
> SOAP message.
>
> 1) Its using SOAP Encoding which is not WS-I compliant. I don't think 
> Axis2 supports SOAP encoding
> 2) The namespace on the Message element is empty.
> 3) There is an xsi:type attribute.
>
> My hunch is that the problem is caused by #1. Can you try the 
> combinations?
>
> Paul
>
> On 5/12/06, *Benjamin Schmeling * <Benjamin_Schmeling@gmx.de 
> <ma...@gmx.de>> wrote:
>
>     The TCP Monitor shows that there is a Create Sequence message and the
>     Sequence message which is sent several times.
>     I compared the messages, when I do the sending with the common
>     mechanism
>     and the one which is not working:
>
>     Not working (When I do it with a custom SOAP message):
>
>     <?xml version='1.0' encoding='UTF-8'?>
>         <soapenv:Envelope
>             xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope/"
>             xmlns:wsa="http://www.w3.org/2005/08/addressing">
>             <soapenv:Header>
>                 <wsa:To>
>                     http://localhost:8080/axis2/services/TestWebservice
>                 </wsa:To>
>                 <wsa:ReplyTo>
>                     <wsa:Address>
>
>     http://192.168.2.28:6060/axis2/services/__ANONYMOUS_SERVICE__/__OPERATION_OUT_IN__
>                     </wsa:Address>
>                 </wsa:ReplyTo>
>                 <wsa:MessageID>
>                     urn:uuid:1D1AD9A62C5E91BDA111474329524691
>                 </wsa:MessageID>
>                 <wsa:Action>testWS1</wsa:Action>
>                 <wsrm:Sequence
>                     xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm"
>                     soapenv:mustUnderstand="1">
>                     <wsrm:Identifier>
>                         urn:uuid:586A806EA5B897625C11474329535803
>                     </wsrm:Identifier>
>                     <wsrm:MessageNumber>1</wsrm:MessageNumber>
>                     <wsrm:LastMessage />
>                 </wsrm:Sequence>
>             </soapenv:Header>
>             <soapenv:Body>
>                 <ns1:testWS1
>
>     xmlns:ns1=" http://localhost:8080/axis2/services/TestWebservice"
>
>     soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
>                     <message xsi:type="xsd:string">test</message>
>                 </ns1:testWS1>
>             </soapenv:Body>
>         </soapenv:Envelope>
>
>     working (this is produced when I do it like in the common examples):
>
>     <soapenv:Envelope
>             xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope/"
>             xmlns:wsa="http://www.w3.org/2005/08/addressing">
>             <soapenv:Header>
>                 <wsa:To>
>                     http://localhost:8080/axis2/services/TestWebservice
>                 </wsa:To>
>                 <wsa:ReplyTo>
>                     <wsa:Address>
>
>     http://192.168.2.28:6060/axis2/services/__ANONYMOUS_SERVICE__/__OPERATION_OUT_IN__
>     <http://192.168.2.28:6060/axis2/services/__ANONYMOUS_SERVICE__/__OPERATION_OUT_IN__>
>                     </wsa:Address>
>                 </wsa:ReplyTo>
>                 <wsa:MessageID>
>                     urn:uuid:A85BC3699C62F1BE9C11474295481541
>                 </wsa:MessageID>
>                 <wsa:Action>testWS1</wsa:Action>
>                 <wsrm:Sequence
>                     xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm"
>                     soapenv:mustUnderstand="1">
>                     <wsrm:Identifier>
>                         urn:uuid:F2318FAB2CF9BB22C211474295494053
>                     </wsrm:Identifier>
>                     <wsrm:MessageNumber>1</wsrm:MessageNumber>
>                     <wsrm:LastMessage />
>                 </wsrm:Sequence>
>             </soapenv:Header>
>             <soapenv:Body>
>                 <TestWebservice:testWS1
>
>     xmlns:TestWebservice="
>     http://localhost:8080/axis2/services/TestWebservice">
>                     <TestWebservice:message>Text</TestWebservice:message>
>                 </TestWebservice:testWS1>
>             </soapenv:Body>
>         </soapenv:Envelope>
>     > Have you tried using the TCPMon to see the message passing through?
>     >
>     > Paul
>     >
>     > On 5/12/06, *Benjamin Schmeling* < Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     > <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>> wrote:
>     >
>     >     Okay,
>     >
>     >     This is the SOAP message:
>     >
>     >     <?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'
>     >     xmlns:wsrm=' http://schemas.xmlsoap.org/ws/2005/02/rm
>     >     <http://schemas.xmlsoap.org/ws/2005/02/rm>'
>     >     xmlns:wsa=' http://schemas.xmlsoap.org/ws/2004/08/addressing'
>     >     <http://schemas.xmlsoap.org/ws/2004/08/addressing%27>>
>     >        <soapenv:Body>
>     >            <ns1:testWS1
>     >     soapenv:encodingStyle='
>     http://schemas.xmlsoap.org/soap/encoding/'
>     >     xmlns:ns1='TestWebservice'>
>     >                <message xsi:type='xsd:string'
>     xmlns=''>test</message>
>     >            </ns1:testWS1>
>     >        </soapenv:Body>
>     >     </soapenv:Envelope>
>     >
>     >     My code looks like this now and the exception is not thrown
>     >     anymore, but
>     >     nevertheless there is no message sent; but an error (12 Mai 2006
>     >     11:32:53,329  INFO AxisEngine:527 - Received Error Message
>     with id
>     >     null):
>     >
>     >     OMElement payload = getPayload(message);
>     >     OMElement omReturn = client.sendReceive(payload);
>     >
>     >     private OMElement getPayload(String soap) throws
>     >     FactoryConfigurationError, IOException, XMLStreamException,
>     >     SAXException, ParserConfigurationException{
>     >             ByteArrayInputStream inStr = new
>     >     ByteArrayInputStream(soap.getBytes());
>     >             SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
>     >             StAXSOAPModelBuilder builder =
>     >    
>     OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     >             SOAPEnvelope env = builder.getSOAPEnvelope();
>     >             return (OMElement) env.getBody().getFirstOMChild();
>     >     }
>     >
>     >     Maybe my axis2 is misconfigured? When I send a simple
>     message like in
>     >     the examples this works but in the server I always got that
>     pn the
>     >     logs:
>     >
>     >     - I/O exception (java.net.ConnectException) caught when
>     processing
>     >     request: Connection refused: connect
>     >     - Retrying request
>     >     - I/O exception (java.net.ConnectException ) caught when
>     processing
>     >     request: Connection refused: connect
>     >     - Retrying request
>     >     ....
>     >
>     >     I am using Sandesha2-1.0 and Axis2-1.0.
>     >
>     >     Thanks,
>     >
>     >     Benjamin
>     >     > Hi Benajamin,
>     >     >
>     >     > There is not sendReveive method that takes a SOAP envelope
>     as the
>     >     > parameter. Instead what you should give is the payload of
>     your SOAP
>     >     > envelope. If you want to add headers there is a seperate
>     >     'adddHeader'
>     >     > method available.
>     >     >
>     >     > If you are still getting the error, please send your full
>     client
>     >     code
>     >     > and the String u use to generate the SOAP envelope, for me to
>     >     > reproduce the error.
>     >     >
>     >     >
>     >     > Chamikara
>     >     >
>     >     >
>     >     > On 5/11/06, *Benjamin Schmeling*
>     <Benjamin_Schmeling@gmx.de <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de> >
>     >     > <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>>> wrote:
>     >     >
>     >     >     Sorry my fault my code looks like this:
>     >     >
>     >     >     ByteArrayInputStream inStr = new
>     >     >     ByteArrayInputStream(soap.getBytes());
>     >     >     SOAPFactory fac =   OMAbstractFactory.getSOAP11Factory();
>     >     >     StAXSOAPModelBuilder builder =
>     >     >     OMXMLBuilderFactory.createStAXSOAPModelBuilder
>     >     >
>     >    
>     (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     >     >
>     >     >     SOAPEnvelope env = builder.getSOAPEnvelope();
>     >     >     OMElement omReturn = client.sendReceive(env);
>     >     >
>     >     >     But the same error like before...
>     >     >     > Hi Benajamin,
>     >     >     >
>     >     >     > As I gave in my previous code example dont use the line
>     >     >     > fac.createSOAPEnvelope (parser) to build the SOAP
>     envelope.
>     >     >     >
>     >     >     > Use the method 'getSOAPEnvelope' of the
>     StAXSOAPModelBuilder,
>     >     >     > Here it is again,
>     >     >     >
>     >     >     > String soap = "....";
>     >     >     > ByteArrayInputStream inStr = new
>     >     >     ByteArrayInputStream(soap.getBytes());
>     >     >     > SOAPFactory fac =  
>     OMAbstractFactory.getSOAP11Factory();
>     >     >     > StAXSOAPModelBuilder builder =
>     >     >     > OMXMLBuilderFactory.createStAXSOAPModelBuilder
>     >     >     >
>     >     >     >
>     >    
>     (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     >     >     > SOAPEnvelope env = builder.getSOAPEnvelope();
>     >     >     > client.sendReceive(env );
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >     > Chamikara
>     >     >     >
>     >     >     >
>     >     >     > On 5/11/06, *Benjamin Schmeling*
>     >     <Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de> <mailto:
>     Benjamin_Schmeling@gmx.de <ma...@gmx.de>>
>     >     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>>
>     >     >     > <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>
>     >     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>>>> wrote:
>     >     >     >
>     >     >     >     Hi,
>     >     >     >
>     >     >     >     String soap = "....";
>     >     >     >     ByteArrayInputStream inStr = new
>     >     >     >     ByteArrayInputStream( soap.getBytes ());
>     >     >     >     SOAPFactory fac =  
>     OMAbstractFactory.getSOAP11Factory();
>     >     >     >     StAXSOAPModelBuilder builder =
>     >     >     >     OMXMLBuilderFactory.createStAXSOAPModelBuilder
>     >     >     >
>     >     >
>     >    
>     (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     >     >     >     SOAPEnvelope env = builder.getSOAPEnvelope();
>     >     >     >     client.sendReceive(fac.createSOAPEnvelope (parser));
>     >     >     >
>     >     >     >     the last line throws the following exception:
>     >     >     >
>     >     >     >     org.apache.axiom.om.OMException : Root Element
>     can not be
>     >     >     detached
>     >     >     >         at
>     >     >     >
>     >     >
>     >    
>     org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.detach(SOAPEnvelopeImpl.java
>     :155)
>     >     >     >         at
>     >     >     >     org.apache.axiom.om.impl.llom.OMNodeImpl.setParent
>     >     >     >     (OMNodeImpl.java :117)
>     >     >     >         at
>     >     >     >
>     >     >
>     >    
>     org.apache.axiom.soap.impl.llom.SOAPElement.setParent(SOAPElement.java:74)
>     >     >     >         at
>     >     >     >    
>     org.apache.axiom.om.impl.llom.OMElementImpl.addChild
>     >     >     (OMElementImpl.java:240)
>     >     >     >         at
>     >     >     >     org.apache.axiom.om.impl.llom.OMElementImpl.addChild
>     >     >     >     (OMElementImpl.java:197)
>     >     >     >         at
>     >     >     >    
>     org.apache.axis2.client.ServiceClient.fillSoapEnvelope
>     >     >     (ServiceClient.java:554)
>     >     >     >         at
>     >     >     >
>     >     >
>     >    
>     org.apache.axis2.client.ServiceClient.sendReceiveNonBlocking(ServiceClient.java
>     >     :467)
>     >     >     >         at
>     >     >     >     org.apache.axis2.client.ServiceClient.sendReceive
>     >     >     (ServiceClient.java:411)
>     >     >     >         at
>     >     >     >
>     >     >     org.apache.axis2.client.ServiceClient.sendReceive
>     >     (ServiceClient.java:394)
>     >     >     >
>     >     >     >     What does this mean?
>     >     >     >     > Hi Benjamin,
>     >     >     >     >
>     >     >     >     > Try following,
>     >     >     >     >
>     >     >     >     > String soap = "....";
>     >     >     >     > ByteArrayInputStream inStr = new
>     >     >     >     ByteArrayInputStream(soap.getBytes());
>     >     >     >     > SOAPFactory fac =
>     >     OMAbstractFactory.getSOAP11Factory();
>     >     >     >     > StAXSOAPModelBuilder builder =
>     >     >     >     >
>     >     >     >
>     >     >
>     >     OMXMLBuilderFactory.createStAXSOAPModelBuilder
>     (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     >     >
>     >     >     >     > SOAPEnvelope env = builder.getSOAPEnvelope();
>     >     >     >     >
>     >     >     >     >
>     >     >     >     >
>     >     >     >     > Chamikara
>     >     >     >     >
>     >     >     >     >
>     >     >     >     >
>     >     >     >     > On 5/10/06, *Benjamin Schmeling* <
>     >     >     Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     <mailto:Benjamin_Schmeling@gmx.de <ma...@gmx.de>>
>     >     <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     <mailto:Benjamin_Schmeling@gmx.de <ma...@gmx.de>>>
>     >     >     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>
>     >     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>>>
>     >     >     >     > <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>
>     >     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>>
>     >     >     >     <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>
>     >     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>>>>> wrote:
>     >     >     >     >
>     >     >     >     >     Hi,
>     >     >     >     >
>     >     >     >     >     I want to write a Web Service which sends
>     >     reliable SOAP
>     >     >     >     messages with
>     >     >     >     >     Sandesha2. My input is a SOAP message as
>     String.
>     >     The
>     >     >     problem
>     >     >     >     is that I
>     >     >     >     >     do not know how to transform this into an
>     OMElement
>     >     >     that can
>     >     >     >     be sent
>     >     >     >     >     with the ServiceClient class.
>     >     >     >     >
>     >     >     >     >     I tried something like this but it did not
>     work:
>     >     >     >     >
>     >     >     >     >     String soap = "....";
>     >     >     >     >     ByteArrayInputStream inStr = new
>     >     >     >     >     ByteArrayInputStream( soap.getBytes());
>     >     >     >     >     SOAPFactory fac =
>     >     OMAbstractFactory.getSOAP11Factory();
>     >     >     >     >     OMXMLParserWrapper parser =
>     >     >     >     >    
>     OMXMLBuilderFactory.createStAXSOAPModelBuilder (fac,
>     >     >     >     >     XMLInputFactory.newInstance
>     >     >     ().createXMLStreamReader(inStr));
>     >     >     >     >     client.sendReceive (fac.createSOAPEnvelope
>     (parser));
>     >     >     >     >
>     >     >     >     >     How can I get this working?
>     >     >     >     >
>     >     >     >     >     Thanks,
>     >     >     >     >
>     >     >     >     >     Benjamin
>     >     >     >     >
>     >     >     >     >
>     >     >     >     >
>     >     >     >
>     >     >
>     >    
>     ---------------------------------------------------------------------
>     >     >     >     >     To unsubscribe, e-mail:
>     >     >     >     sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>>
>     >     >     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>>>
>     >     >     >     >     <mailto:
>     sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>>
>     >     >     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>>>>
>     >     >     >     >     For additional commands, e-mail:
>     >     >     >     sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>>
>     >     >     >     <mailto: sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>>>
>     >     >     >     >     <mailto: sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto: sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>>
>     >     >     >     <mailto: sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto: sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>>>>
>     >     >     >     >
>     >     >     >     >
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >
>     >     >
>     >     >
>     >
>     >
>     >
>     >    
>     ---------------------------------------------------------------------
>     >     To unsubscribe, e-mail:
>     sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     For additional commands, e-mail:
>     sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>
>     >
>     >
>     >
>     >
>     > --
>     > Paul Fremantle
>     > VP/Technology, WSO2 and OASIS WS-RX TC Co-chair
>     >
>     > http://bloglines.com/blog/paulfremantle
>     <http://bloglines.com/blog/paulfremantle>
>     > paul@wso2.com <ma...@wso2.com> <mailto:paul@wso2.com
>     <ma...@wso2.com>>
>     >
>     > "Oxygenating the Web Service Platform", www.wso2.com
>     <http://www.wso2.com> <http://www.wso2.com>
>
>
>
>
>
> -- 
> Paul Fremantle
> VP/Technology, WSO2 and OASIS WS-RX TC Co-chair
>
> http://bloglines.com/blog/paulfremantle
> paul@wso2.com <ma...@wso2.com>
>
> "Oxygenating the Web Service Platform", www.wso2.com <http://www.wso2.com>



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org


Re: Sending a custom SOAP message with Sandesha2

Posted by Benjamin Schmeling <Be...@gmx.de>.
The TCP Monitor shows that there is a Create Sequence message and the 
Sequence message which is sent several times.
I compared the messages, when I do the sending with the common mechanism 
and the one which is not working:

Not working (When I do it with a custom SOAP message):

<?xml version='1.0' encoding='UTF-8'?>
    <soapenv:Envelope
        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:wsa="http://www.w3.org/2005/08/addressing">
        <soapenv:Header>
            <wsa:To>
                http://localhost:8080/axis2/services/TestWebservice
            </wsa:To>
            <wsa:ReplyTo>
                <wsa:Address>
                    
http://192.168.2.28:6060/axis2/services/__ANONYMOUS_SERVICE__/__OPERATION_OUT_IN__
                </wsa:Address>
            </wsa:ReplyTo>
            <wsa:MessageID>
                urn:uuid:1D1AD9A62C5E91BDA111474329524691
            </wsa:MessageID>
            <wsa:Action>testWS1</wsa:Action>
            <wsrm:Sequence
                xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm"
                soapenv:mustUnderstand="1">
                <wsrm:Identifier>
                    urn:uuid:586A806EA5B897625C11474329535803
                </wsrm:Identifier>
                <wsrm:MessageNumber>1</wsrm:MessageNumber>
                <wsrm:LastMessage />
            </wsrm:Sequence>
        </soapenv:Header>
        <soapenv:Body>
            <ns1:testWS1
                
xmlns:ns1="http://localhost:8080/axis2/services/TestWebservice"
                
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
                <message xsi:type="xsd:string">test</message>
            </ns1:testWS1>
        </soapenv:Body>
    </soapenv:Envelope>

working (this is produced when I do it like in the common examples):

<soapenv:Envelope
        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:wsa="http://www.w3.org/2005/08/addressing">
        <soapenv:Header>
            <wsa:To>
                http://localhost:8080/axis2/services/TestWebservice
            </wsa:To>
            <wsa:ReplyTo>
                <wsa:Address>
                    
http://192.168.2.28:6060/axis2/services/__ANONYMOUS_SERVICE__/__OPERATION_OUT_IN__
                </wsa:Address>
            </wsa:ReplyTo>
            <wsa:MessageID>
                urn:uuid:A85BC3699C62F1BE9C11474295481541
            </wsa:MessageID>
            <wsa:Action>testWS1</wsa:Action>
            <wsrm:Sequence
                xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm"
                soapenv:mustUnderstand="1">
                <wsrm:Identifier>
                    urn:uuid:F2318FAB2CF9BB22C211474295494053
                </wsrm:Identifier>
                <wsrm:MessageNumber>1</wsrm:MessageNumber>
                <wsrm:LastMessage />
            </wsrm:Sequence>
        </soapenv:Header>
        <soapenv:Body>
            <TestWebservice:testWS1
                
xmlns:TestWebservice="http://localhost:8080/axis2/services/TestWebservice">
                <TestWebservice:message>Text</TestWebservice:message>
            </TestWebservice:testWS1>
        </soapenv:Body>
    </soapenv:Envelope>
> Have you tried using the TCPMon to see the message passing through?
>
> Paul
>
> On 5/12/06, *Benjamin Schmeling* < Benjamin_Schmeling@gmx.de 
> <ma...@gmx.de>> wrote:
>
>     Okay,
>
>     This is the SOAP message:
>
>     <?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'
>     xmlns:wsrm='http://schemas.xmlsoap.org/ws/2005/02/rm
>     <http://schemas.xmlsoap.org/ws/2005/02/rm>'
>     xmlns:wsa='http://schemas.xmlsoap.org/ws/2004/08/addressing'
>     <http://schemas.xmlsoap.org/ws/2004/08/addressing%27>>
>        <soapenv:Body>
>            <ns1:testWS1
>     soapenv:encodingStyle=' http://schemas.xmlsoap.org/soap/encoding/'
>     xmlns:ns1='TestWebservice'>
>                <message xsi:type='xsd:string' xmlns=''>test</message>
>            </ns1:testWS1>
>        </soapenv:Body>
>     </soapenv:Envelope>
>
>     My code looks like this now and the exception is not thrown
>     anymore, but
>     nevertheless there is no message sent; but an error (12 Mai 2006
>     11:32:53,329  INFO AxisEngine:527 - Received Error Message with id
>     null):
>
>     OMElement payload = getPayload(message);
>     OMElement omReturn = client.sendReceive(payload);
>
>     private OMElement getPayload(String soap) throws
>     FactoryConfigurationError, IOException, XMLStreamException,
>     SAXException, ParserConfigurationException{
>             ByteArrayInputStream inStr = new
>     ByteArrayInputStream(soap.getBytes());
>             SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
>             StAXSOAPModelBuilder builder =
>     OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>             SOAPEnvelope env = builder.getSOAPEnvelope();
>             return (OMElement) env.getBody().getFirstOMChild();
>     }
>
>     Maybe my axis2 is misconfigured? When I send a simple message like in
>     the examples this works but in the server I always got that pn the
>     logs:
>
>     - I/O exception (java.net.ConnectException) caught when processing
>     request: Connection refused: connect
>     - Retrying request
>     - I/O exception (java.net.ConnectException) caught when processing
>     request: Connection refused: connect
>     - Retrying request
>     ....
>
>     I am using Sandesha2-1.0 and Axis2-1.0.
>
>     Thanks,
>
>     Benjamin
>     > Hi Benajamin,
>     >
>     > There is not sendReveive method that takes a SOAP envelope as the
>     > parameter. Instead what you should give is the payload of your SOAP
>     > envelope. If you want to add headers there is a seperate
>     'adddHeader'
>     > method available.
>     >
>     > If you are still getting the error, please send your full client
>     code
>     > and the String u use to generate the SOAP envelope, for me to
>     > reproduce the error.
>     >
>     >
>     > Chamikara
>     >
>     >
>     > On 5/11/06, *Benjamin Schmeling* <Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     > <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>> wrote:
>     >
>     >     Sorry my fault my code looks like this:
>     >
>     >     ByteArrayInputStream inStr = new
>     >     ByteArrayInputStream(soap.getBytes());
>     >     SOAPFactory fac =   OMAbstractFactory.getSOAP11Factory();
>     >     StAXSOAPModelBuilder builder =
>     >     OMXMLBuilderFactory.createStAXSOAPModelBuilder
>     >    
>     (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     >
>     >     SOAPEnvelope env = builder.getSOAPEnvelope();
>     >     OMElement omReturn = client.sendReceive(env);
>     >
>     >     But the same error like before...
>     >     > Hi Benajamin,
>     >     >
>     >     > As I gave in my previous code example dont use the line
>     >     > fac.createSOAPEnvelope (parser) to build the SOAP envelope.
>     >     >
>     >     > Use the method 'getSOAPEnvelope' of the StAXSOAPModelBuilder,
>     >     > Here it is again,
>     >     >
>     >     > String soap = "....";
>     >     > ByteArrayInputStream inStr = new
>     >     ByteArrayInputStream(soap.getBytes());
>     >     > SOAPFactory fac =   OMAbstractFactory.getSOAP11Factory();
>     >     > StAXSOAPModelBuilder builder =
>     >     > OMXMLBuilderFactory.createStAXSOAPModelBuilder
>     >     >
>     >     >
>     (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     >     > SOAPEnvelope env = builder.getSOAPEnvelope();
>     >     > client.sendReceive(env );
>     >     >
>     >     >
>     >     >
>     >     >
>     >     > Chamikara
>     >     >
>     >     >
>     >     > On 5/11/06, *Benjamin Schmeling*
>     <Benjamin_Schmeling@gmx.de <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>
>     >     > <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>>> wrote:
>     >     >
>     >     >     Hi,
>     >     >
>     >     >     String soap = "....";
>     >     >     ByteArrayInputStream inStr = new
>     >     >     ByteArrayInputStream(soap.getBytes ());
>     >     >     SOAPFactory fac =   OMAbstractFactory.getSOAP11Factory();
>     >     >     StAXSOAPModelBuilder builder =
>     >     >     OMXMLBuilderFactory.createStAXSOAPModelBuilder
>     >     >
>     >    
>     (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     >     >     SOAPEnvelope env = builder.getSOAPEnvelope();
>     >     >     client.sendReceive(fac.createSOAPEnvelope (parser));
>     >     >
>     >     >     the last line throws the following exception:
>     >     >
>     >     >     org.apache.axiom.om.OMException : Root Element can not be
>     >     detached
>     >     >         at
>     >     >
>     >    
>     org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.detach(SOAPEnvelopeImpl.java:155)
>     >     >         at
>     >     >     org.apache.axiom.om.impl.llom.OMNodeImpl.setParent
>     >     >     (OMNodeImpl.java :117)
>     >     >         at
>     >     >
>     >    
>     org.apache.axiom.soap.impl.llom.SOAPElement.setParent(SOAPElement.java:74)
>     >     >         at
>     >     >     org.apache.axiom.om.impl.llom.OMElementImpl.addChild
>     >     (OMElementImpl.java:240)
>     >     >         at
>     >     >     org.apache.axiom.om.impl.llom.OMElementImpl.addChild
>     >     >     (OMElementImpl.java:197)
>     >     >         at
>     >     >     org.apache.axis2.client.ServiceClient.fillSoapEnvelope
>     >     (ServiceClient.java:554)
>     >     >         at
>     >     >
>     >    
>     org.apache.axis2.client.ServiceClient.sendReceiveNonBlocking(ServiceClient.java
>     :467)
>     >     >         at
>     >     >     org.apache.axis2.client.ServiceClient.sendReceive
>     >     (ServiceClient.java:411)
>     >     >         at
>     >     >
>     >     org.apache.axis2.client.ServiceClient.sendReceive
>     (ServiceClient.java:394)
>     >     >
>     >     >     What does this mean?
>     >     >     > Hi Benjamin,
>     >     >     >
>     >     >     > Try following,
>     >     >     >
>     >     >     > String soap = "....";
>     >     >     > ByteArrayInputStream inStr = new
>     >     >     ByteArrayInputStream(soap.getBytes());
>     >     >     > SOAPFactory fac =  
>     OMAbstractFactory.getSOAP11Factory();
>     >     >     > StAXSOAPModelBuilder builder =
>     >     >     >
>     >     >
>     >    
>     OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     >
>     >     >     > SOAPEnvelope env = builder.getSOAPEnvelope();
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >     > Chamikara
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >     > On 5/10/06, *Benjamin Schmeling* <
>     >     Benjamin_Schmeling@gmx.de <ma...@gmx.de>
>     <mailto:Benjamin_Schmeling@gmx.de <ma...@gmx.de>>
>     >     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>>
>     >     >     > <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>
>     >     >     <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>>>> wrote:
>     >     >     >
>     >     >     >     Hi,
>     >     >     >
>     >     >     >     I want to write a Web Service which sends
>     reliable SOAP
>     >     >     messages with
>     >     >     >     Sandesha2. My input is a SOAP message as String.
>     The
>     >     problem
>     >     >     is that I
>     >     >     >     do not know how to transform this into an OMElement
>     >     that can
>     >     >     be sent
>     >     >     >     with the ServiceClient class.
>     >     >     >
>     >     >     >     I tried something like this but it did not work:
>     >     >     >
>     >     >     >     String soap = "....";
>     >     >     >     ByteArrayInputStream inStr = new
>     >     >     >     ByteArrayInputStream( soap.getBytes());
>     >     >     >     SOAPFactory fac =  
>     OMAbstractFactory.getSOAP11Factory();
>     >     >     >     OMXMLParserWrapper parser =
>     >     >     >     OMXMLBuilderFactory.createStAXSOAPModelBuilder (fac,
>     >     >     >     XMLInputFactory.newInstance
>     >     ().createXMLStreamReader(inStr));
>     >     >     >     client.sendReceive(fac.createSOAPEnvelope (parser));
>     >     >     >
>     >     >     >     How can I get this working?
>     >     >     >
>     >     >     >     Thanks,
>     >     >     >
>     >     >     >     Benjamin
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >
>     >    
>     ---------------------------------------------------------------------
>     >     >     >     To unsubscribe, e-mail:
>     >     >     sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>>
>     >     >     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>>>
>     >     >     >     For additional commands, e-mail:
>     >     >     sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto: sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>>
>     >     >     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto: sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>>>
>     >     >     >
>     >     >     >
>     >     >
>     >     >
>     >     >
>     >
>     >
>     >
>
>
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     For additional commands, e-mail: sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>
>
>
>
> -- 
> Paul Fremantle
> VP/Technology, WSO2 and OASIS WS-RX TC Co-chair
>
> http://bloglines.com/blog/paulfremantle
> paul@wso2.com <ma...@wso2.com>
>
> "Oxygenating the Web Service Platform", www.wso2.com <http://www.wso2.com>



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org


Re: Sending a custom SOAP message with Sandesha2

Posted by Benjamin Schmeling <Be...@gmx.de>.
The TCP Monitor shows that there is a Create Sequence message and the 
Sequence message which is sent several times.
I compared the messages, when I do the sending with the common mechanism 
and the one which is not working:

Not working (When I do it with a custom SOAP message):

<?xml version='1.0' encoding='UTF-8'?>
    <soapenv:Envelope
        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:wsa="http://www.w3.org/2005/08/addressing">
        <soapenv:Header>
            <wsa:To>
                http://localhost:8080/axis2/services/TestWebservice
            </wsa:To>
            <wsa:ReplyTo>
                <wsa:Address>
                    
http://192.168.2.28:6060/axis2/services/__ANONYMOUS_SERVICE__/__OPERATION_OUT_IN__
                </wsa:Address>
            </wsa:ReplyTo>
            <wsa:MessageID>
                urn:uuid:1D1AD9A62C5E91BDA111474329524691
            </wsa:MessageID>
            <wsa:Action>testWS1</wsa:Action>
            <wsrm:Sequence
                xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm"
                soapenv:mustUnderstand="1">
                <wsrm:Identifier>
                    urn:uuid:586A806EA5B897625C11474329535803
                </wsrm:Identifier>
                <wsrm:MessageNumber>1</wsrm:MessageNumber>
                <wsrm:LastMessage />
            </wsrm:Sequence>
        </soapenv:Header>
        <soapenv:Body>
            <ns1:testWS1
                
xmlns:ns1="http://localhost:8080/axis2/services/TestWebservice"
                
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
                <message xsi:type="xsd:string">test</message>
            </ns1:testWS1>
        </soapenv:Body>
    </soapenv:Envelope>

working (this is produced when I do it like in the common examples):

<soapenv:Envelope
        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:wsa="http://www.w3.org/2005/08/addressing">
        <soapenv:Header>
            <wsa:To>
                http://localhost:8080/axis2/services/TestWebservice
            </wsa:To>
            <wsa:ReplyTo>
                <wsa:Address>
                    
http://192.168.2.28:6060/axis2/services/__ANONYMOUS_SERVICE__/__OPERATION_OUT_IN__
                </wsa:Address>
            </wsa:ReplyTo>
            <wsa:MessageID>
                urn:uuid:A85BC3699C62F1BE9C11474295481541
            </wsa:MessageID>
            <wsa:Action>testWS1</wsa:Action>
            <wsrm:Sequence
                xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm"
                soapenv:mustUnderstand="1">
                <wsrm:Identifier>
                    urn:uuid:F2318FAB2CF9BB22C211474295494053
                </wsrm:Identifier>
                <wsrm:MessageNumber>1</wsrm:MessageNumber>
                <wsrm:LastMessage />
            </wsrm:Sequence>
        </soapenv:Header>
        <soapenv:Body>
            <TestWebservice:testWS1
                
xmlns:TestWebservice="http://localhost:8080/axis2/services/TestWebservice">
                <TestWebservice:message>Text</TestWebservice:message>
            </TestWebservice:testWS1>
        </soapenv:Body>
    </soapenv:Envelope>
> Have you tried using the TCPMon to see the message passing through?
>
> Paul
>
> On 5/12/06, *Benjamin Schmeling* < Benjamin_Schmeling@gmx.de 
> <ma...@gmx.de>> wrote:
>
>     Okay,
>
>     This is the SOAP message:
>
>     <?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'
>     xmlns:wsrm='http://schemas.xmlsoap.org/ws/2005/02/rm
>     <http://schemas.xmlsoap.org/ws/2005/02/rm>'
>     xmlns:wsa='http://schemas.xmlsoap.org/ws/2004/08/addressing'
>     <http://schemas.xmlsoap.org/ws/2004/08/addressing%27>>
>        <soapenv:Body>
>            <ns1:testWS1
>     soapenv:encodingStyle=' http://schemas.xmlsoap.org/soap/encoding/'
>     xmlns:ns1='TestWebservice'>
>                <message xsi:type='xsd:string' xmlns=''>test</message>
>            </ns1:testWS1>
>        </soapenv:Body>
>     </soapenv:Envelope>
>
>     My code looks like this now and the exception is not thrown
>     anymore, but
>     nevertheless there is no message sent; but an error (12 Mai 2006
>     11:32:53,329  INFO AxisEngine:527 - Received Error Message with id
>     null):
>
>     OMElement payload = getPayload(message);
>     OMElement omReturn = client.sendReceive(payload);
>
>     private OMElement getPayload(String soap) throws
>     FactoryConfigurationError, IOException, XMLStreamException,
>     SAXException, ParserConfigurationException{
>             ByteArrayInputStream inStr = new
>     ByteArrayInputStream(soap.getBytes());
>             SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
>             StAXSOAPModelBuilder builder =
>     OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>             SOAPEnvelope env = builder.getSOAPEnvelope();
>             return (OMElement) env.getBody().getFirstOMChild();
>     }
>
>     Maybe my axis2 is misconfigured? When I send a simple message like in
>     the examples this works but in the server I always got that pn the
>     logs:
>
>     - I/O exception (java.net.ConnectException) caught when processing
>     request: Connection refused: connect
>     - Retrying request
>     - I/O exception (java.net.ConnectException) caught when processing
>     request: Connection refused: connect
>     - Retrying request
>     ....
>
>     I am using Sandesha2-1.0 and Axis2-1.0.
>
>     Thanks,
>
>     Benjamin
>     > Hi Benajamin,
>     >
>     > There is not sendReveive method that takes a SOAP envelope as the
>     > parameter. Instead what you should give is the payload of your SOAP
>     > envelope. If you want to add headers there is a seperate
>     'adddHeader'
>     > method available.
>     >
>     > If you are still getting the error, please send your full client
>     code
>     > and the String u use to generate the SOAP envelope, for me to
>     > reproduce the error.
>     >
>     >
>     > Chamikara
>     >
>     >
>     > On 5/11/06, *Benjamin Schmeling* <Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     > <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>> wrote:
>     >
>     >     Sorry my fault my code looks like this:
>     >
>     >     ByteArrayInputStream inStr = new
>     >     ByteArrayInputStream(soap.getBytes());
>     >     SOAPFactory fac =   OMAbstractFactory.getSOAP11Factory();
>     >     StAXSOAPModelBuilder builder =
>     >     OMXMLBuilderFactory.createStAXSOAPModelBuilder
>     >    
>     (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     >
>     >     SOAPEnvelope env = builder.getSOAPEnvelope();
>     >     OMElement omReturn = client.sendReceive(env);
>     >
>     >     But the same error like before...
>     >     > Hi Benajamin,
>     >     >
>     >     > As I gave in my previous code example dont use the line
>     >     > fac.createSOAPEnvelope (parser) to build the SOAP envelope.
>     >     >
>     >     > Use the method 'getSOAPEnvelope' of the StAXSOAPModelBuilder,
>     >     > Here it is again,
>     >     >
>     >     > String soap = "....";
>     >     > ByteArrayInputStream inStr = new
>     >     ByteArrayInputStream(soap.getBytes());
>     >     > SOAPFactory fac =   OMAbstractFactory.getSOAP11Factory();
>     >     > StAXSOAPModelBuilder builder =
>     >     > OMXMLBuilderFactory.createStAXSOAPModelBuilder
>     >     >
>     >     >
>     (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     >     > SOAPEnvelope env = builder.getSOAPEnvelope();
>     >     > client.sendReceive(env );
>     >     >
>     >     >
>     >     >
>     >     >
>     >     > Chamikara
>     >     >
>     >     >
>     >     > On 5/11/06, *Benjamin Schmeling*
>     <Benjamin_Schmeling@gmx.de <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>
>     >     > <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>>> wrote:
>     >     >
>     >     >     Hi,
>     >     >
>     >     >     String soap = "....";
>     >     >     ByteArrayInputStream inStr = new
>     >     >     ByteArrayInputStream(soap.getBytes ());
>     >     >     SOAPFactory fac =   OMAbstractFactory.getSOAP11Factory();
>     >     >     StAXSOAPModelBuilder builder =
>     >     >     OMXMLBuilderFactory.createStAXSOAPModelBuilder
>     >     >
>     >    
>     (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     >     >     SOAPEnvelope env = builder.getSOAPEnvelope();
>     >     >     client.sendReceive(fac.createSOAPEnvelope (parser));
>     >     >
>     >     >     the last line throws the following exception:
>     >     >
>     >     >     org.apache.axiom.om.OMException : Root Element can not be
>     >     detached
>     >     >         at
>     >     >
>     >    
>     org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.detach(SOAPEnvelopeImpl.java:155)
>     >     >         at
>     >     >     org.apache.axiom.om.impl.llom.OMNodeImpl.setParent
>     >     >     (OMNodeImpl.java :117)
>     >     >         at
>     >     >
>     >    
>     org.apache.axiom.soap.impl.llom.SOAPElement.setParent(SOAPElement.java:74)
>     >     >         at
>     >     >     org.apache.axiom.om.impl.llom.OMElementImpl.addChild
>     >     (OMElementImpl.java:240)
>     >     >         at
>     >     >     org.apache.axiom.om.impl.llom.OMElementImpl.addChild
>     >     >     (OMElementImpl.java:197)
>     >     >         at
>     >     >     org.apache.axis2.client.ServiceClient.fillSoapEnvelope
>     >     (ServiceClient.java:554)
>     >     >         at
>     >     >
>     >    
>     org.apache.axis2.client.ServiceClient.sendReceiveNonBlocking(ServiceClient.java
>     :467)
>     >     >         at
>     >     >     org.apache.axis2.client.ServiceClient.sendReceive
>     >     (ServiceClient.java:411)
>     >     >         at
>     >     >
>     >     org.apache.axis2.client.ServiceClient.sendReceive
>     (ServiceClient.java:394)
>     >     >
>     >     >     What does this mean?
>     >     >     > Hi Benjamin,
>     >     >     >
>     >     >     > Try following,
>     >     >     >
>     >     >     > String soap = "....";
>     >     >     > ByteArrayInputStream inStr = new
>     >     >     ByteArrayInputStream(soap.getBytes());
>     >     >     > SOAPFactory fac =  
>     OMAbstractFactory.getSOAP11Factory();
>     >     >     > StAXSOAPModelBuilder builder =
>     >     >     >
>     >     >
>     >    
>     OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     >
>     >     >     > SOAPEnvelope env = builder.getSOAPEnvelope();
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >     > Chamikara
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >     > On 5/10/06, *Benjamin Schmeling* <
>     >     Benjamin_Schmeling@gmx.de <ma...@gmx.de>
>     <mailto:Benjamin_Schmeling@gmx.de <ma...@gmx.de>>
>     >     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>>
>     >     >     > <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>
>     >     >     <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>>>> wrote:
>     >     >     >
>     >     >     >     Hi,
>     >     >     >
>     >     >     >     I want to write a Web Service which sends
>     reliable SOAP
>     >     >     messages with
>     >     >     >     Sandesha2. My input is a SOAP message as String.
>     The
>     >     problem
>     >     >     is that I
>     >     >     >     do not know how to transform this into an OMElement
>     >     that can
>     >     >     be sent
>     >     >     >     with the ServiceClient class.
>     >     >     >
>     >     >     >     I tried something like this but it did not work:
>     >     >     >
>     >     >     >     String soap = "....";
>     >     >     >     ByteArrayInputStream inStr = new
>     >     >     >     ByteArrayInputStream( soap.getBytes());
>     >     >     >     SOAPFactory fac =  
>     OMAbstractFactory.getSOAP11Factory();
>     >     >     >     OMXMLParserWrapper parser =
>     >     >     >     OMXMLBuilderFactory.createStAXSOAPModelBuilder (fac,
>     >     >     >     XMLInputFactory.newInstance
>     >     ().createXMLStreamReader(inStr));
>     >     >     >     client.sendReceive(fac.createSOAPEnvelope (parser));
>     >     >     >
>     >     >     >     How can I get this working?
>     >     >     >
>     >     >     >     Thanks,
>     >     >     >
>     >     >     >     Benjamin
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >
>     >    
>     ---------------------------------------------------------------------
>     >     >     >     To unsubscribe, e-mail:
>     >     >     sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>>
>     >     >     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>>>
>     >     >     >     For additional commands, e-mail:
>     >     >     sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto: sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>>
>     >     >     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto: sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>>>
>     >     >     >
>     >     >     >
>     >     >
>     >     >
>     >     >
>     >
>     >
>     >
>
>
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     For additional commands, e-mail: sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>
>
>
>
> -- 
> Paul Fremantle
> VP/Technology, WSO2 and OASIS WS-RX TC Co-chair
>
> http://bloglines.com/blog/paulfremantle
> paul@wso2.com <ma...@wso2.com>
>
> "Oxygenating the Web Service Platform", www.wso2.com <http://www.wso2.com>



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org


Re: Sending a custom SOAP message with Sandesha2

Posted by Benjamin Schmeling <Be...@gmx.de>.
Okay,

This is the SOAP message:

<?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' 
xmlns:wsrm='http://schemas.xmlsoap.org/ws/2005/02/rm' 
xmlns:wsa='http://schemas.xmlsoap.org/ws/2004/08/addressing'>
   <soapenv:Body>
       <ns1:testWS1 
soapenv:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' 
xmlns:ns1='TestWebservice'>
           <message xsi:type='xsd:string' xmlns=''>test</message>
       </ns1:testWS1>
   </soapenv:Body>
</soapenv:Envelope>

My code looks like this now and the exception is not thrown anymore, but 
nevertheless there is no message sent; but an error (12 Mai 2006 
11:32:53,329  INFO AxisEngine:527 - Received Error Message with id null):

OMElement payload = getPayload(message);
OMElement omReturn = client.sendReceive(payload);

private OMElement getPayload(String soap) throws 
FactoryConfigurationError, IOException, XMLStreamException, 
SAXException, ParserConfigurationException{
        ByteArrayInputStream inStr = new 
ByteArrayInputStream(soap.getBytes());
        SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
        StAXSOAPModelBuilder builder =   
OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
        SOAPEnvelope env = builder.getSOAPEnvelope();
        return (OMElement) env.getBody().getFirstOMChild();
}

Maybe my axis2 is misconfigured? When I send a simple message like in 
the examples this works but in the server I always got that pn the logs:

- I/O exception (java.net.ConnectException) caught when processing 
request: Connection refused: connect
- Retrying request
- I/O exception (java.net.ConnectException) caught when processing 
request: Connection refused: connect
- Retrying request
....

I am using Sandesha2-1.0 and Axis2-1.0.

Thanks,

Benjamin
> Hi Benajamin,
>
> There is not sendReveive method that takes a SOAP envelope as the 
> parameter. Instead what you should give is the payload of your SOAP 
> envelope. If you want to add headers there is a seperate 'adddHeader' 
> method available.
>
> If you are still getting the error, please send your full client code 
> and the String u use to generate the SOAP envelope, for me to 
> reproduce the error.
>
>
> Chamikara
>
>
> On 5/11/06, *Benjamin Schmeling* <Benjamin_Schmeling@gmx.de 
> <ma...@gmx.de>> wrote:
>
>     Sorry my fault my code looks like this:
>
>     ByteArrayInputStream inStr = new
>     ByteArrayInputStream(soap.getBytes());
>     SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
>     StAXSOAPModelBuilder builder =
>     OMXMLBuilderFactory.createStAXSOAPModelBuilder
>     (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>
>     SOAPEnvelope env = builder.getSOAPEnvelope();
>     OMElement omReturn = client.sendReceive(env);
>
>     But the same error like before...
>     > Hi Benajamin,
>     >
>     > As I gave in my previous code example dont use the line
>     > fac.createSOAPEnvelope (parser) to build the SOAP envelope.
>     >
>     > Use the method 'getSOAPEnvelope' of the StAXSOAPModelBuilder,
>     > Here it is again,
>     >
>     > String soap = "....";
>     > ByteArrayInputStream inStr = new
>     ByteArrayInputStream(soap.getBytes());
>     > SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
>     > StAXSOAPModelBuilder builder =
>     > OMXMLBuilderFactory.createStAXSOAPModelBuilder
>     >
>     > (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     > SOAPEnvelope env = builder.getSOAPEnvelope();
>     > client.sendReceive(env );
>     >
>     >
>     >
>     >
>     > Chamikara
>     >
>     >
>     > On 5/11/06, *Benjamin Schmeling* <Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     > <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>> wrote:
>     >
>     >     Hi,
>     >
>     >     String soap = "....";
>     >     ByteArrayInputStream inStr = new
>     >     ByteArrayInputStream(soap.getBytes());
>     >     SOAPFactory fac =   OMAbstractFactory.getSOAP11Factory();
>     >     StAXSOAPModelBuilder builder =
>     >     OMXMLBuilderFactory.createStAXSOAPModelBuilder
>     >    
>     (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     >     SOAPEnvelope env = builder.getSOAPEnvelope();
>     >     client.sendReceive(fac.createSOAPEnvelope (parser));
>     >
>     >     the last line throws the following exception:
>     >
>     >     org.apache.axiom.om.OMException : Root Element can not be
>     detached
>     >         at
>     >    
>     org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.detach(SOAPEnvelopeImpl.java:155)
>     >         at
>     >     org.apache.axiom.om.impl.llom.OMNodeImpl.setParent
>     >     (OMNodeImpl.java:117)
>     >         at
>     >    
>     org.apache.axiom.soap.impl.llom.SOAPElement.setParent(SOAPElement.java:74)
>     >         at
>     >     org.apache.axiom.om.impl.llom.OMElementImpl.addChild
>     (OMElementImpl.java:240)
>     >         at
>     >     org.apache.axiom.om.impl.llom.OMElementImpl.addChild
>     >     (OMElementImpl.java:197)
>     >         at
>     >     org.apache.axis2.client.ServiceClient.fillSoapEnvelope
>     (ServiceClient.java:554)
>     >         at
>     >    
>     org.apache.axis2.client.ServiceClient.sendReceiveNonBlocking(ServiceClient.java:467)
>     >         at
>     >     org.apache.axis2.client.ServiceClient.sendReceive
>     (ServiceClient.java:411)
>     >         at
>     >    
>     org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:394)
>     >
>     >     What does this mean?
>     >     > Hi Benjamin,
>     >     >
>     >     > Try following,
>     >     >
>     >     > String soap = "....";
>     >     > ByteArrayInputStream inStr = new
>     >     ByteArrayInputStream(soap.getBytes());
>     >     > SOAPFactory fac =   OMAbstractFactory.getSOAP11Factory();
>     >     > StAXSOAPModelBuilder builder =
>     >     >
>     >    
>     OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>
>     >     > SOAPEnvelope env = builder.getSOAPEnvelope();
>     >     >
>     >     >
>     >     >
>     >     > Chamikara
>     >     >
>     >     >
>     >     >
>     >     > On 5/10/06, *Benjamin Schmeling* <
>     Benjamin_Schmeling@gmx.de <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>
>     >     > <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>>> wrote:
>     >     >
>     >     >     Hi,
>     >     >
>     >     >     I want to write a Web Service which sends reliable SOAP
>     >     messages with
>     >     >     Sandesha2. My input is a SOAP message as String. The
>     problem
>     >     is that I
>     >     >     do not know how to transform this into an OMElement
>     that can
>     >     be sent
>     >     >     with the ServiceClient class.
>     >     >
>     >     >     I tried something like this but it did not work:
>     >     >
>     >     >     String soap = "....";
>     >     >     ByteArrayInputStream inStr = new
>     >     >     ByteArrayInputStream( soap.getBytes());
>     >     >     SOAPFactory fac =   OMAbstractFactory.getSOAP11Factory();
>     >     >     OMXMLParserWrapper parser =
>     >     >     OMXMLBuilderFactory.createStAXSOAPModelBuilder (fac,
>     >     >     XMLInputFactory.newInstance
>     ().createXMLStreamReader(inStr));
>     >     >     client.sendReceive(fac.createSOAPEnvelope (parser));
>     >     >
>     >     >     How can I get this working?
>     >     >
>     >     >     Thanks,
>     >     >
>     >     >     Benjamin
>     >     >
>     >     >
>     >     >
>     >    
>     ---------------------------------------------------------------------
>     >     >     To unsubscribe, e-mail:
>     >     sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>>
>     >     >     For additional commands, e-mail:
>     >     sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto: sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto: sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>>
>     >     >
>     >     >
>     >
>     >
>     >
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org


Re: Sending a custom SOAP message with Sandesha2

Posted by Benjamin Schmeling <Be...@gmx.de>.
Okay,

This is the SOAP message:

<?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' 
xmlns:wsrm='http://schemas.xmlsoap.org/ws/2005/02/rm' 
xmlns:wsa='http://schemas.xmlsoap.org/ws/2004/08/addressing'>
   <soapenv:Body>
       <ns1:testWS1 
soapenv:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' 
xmlns:ns1='TestWebservice'>
           <message xsi:type='xsd:string' xmlns=''>test</message>
       </ns1:testWS1>
   </soapenv:Body>
</soapenv:Envelope>

My code looks like this now and the exception is not thrown anymore, but 
nevertheless there is no message sent; but an error (12 Mai 2006 
11:32:53,329  INFO AxisEngine:527 - Received Error Message with id null):

OMElement payload = getPayload(message);
OMElement omReturn = client.sendReceive(payload);

private OMElement getPayload(String soap) throws 
FactoryConfigurationError, IOException, XMLStreamException, 
SAXException, ParserConfigurationException{
        ByteArrayInputStream inStr = new 
ByteArrayInputStream(soap.getBytes());
        SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
        StAXSOAPModelBuilder builder =   
OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
        SOAPEnvelope env = builder.getSOAPEnvelope();
        return (OMElement) env.getBody().getFirstOMChild();
}

Maybe my axis2 is misconfigured? When I send a simple message like in 
the examples this works but in the server I always got that pn the logs:

- I/O exception (java.net.ConnectException) caught when processing 
request: Connection refused: connect
- Retrying request
- I/O exception (java.net.ConnectException) caught when processing 
request: Connection refused: connect
- Retrying request
....

I am using Sandesha2-1.0 and Axis2-1.0.

Thanks,

Benjamin
> Hi Benajamin,
>
> There is not sendReveive method that takes a SOAP envelope as the 
> parameter. Instead what you should give is the payload of your SOAP 
> envelope. If you want to add headers there is a seperate 'adddHeader' 
> method available.
>
> If you are still getting the error, please send your full client code 
> and the String u use to generate the SOAP envelope, for me to 
> reproduce the error.
>
>
> Chamikara
>
>
> On 5/11/06, *Benjamin Schmeling* <Benjamin_Schmeling@gmx.de 
> <ma...@gmx.de>> wrote:
>
>     Sorry my fault my code looks like this:
>
>     ByteArrayInputStream inStr = new
>     ByteArrayInputStream(soap.getBytes());
>     SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
>     StAXSOAPModelBuilder builder =
>     OMXMLBuilderFactory.createStAXSOAPModelBuilder
>     (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>
>     SOAPEnvelope env = builder.getSOAPEnvelope();
>     OMElement omReturn = client.sendReceive(env);
>
>     But the same error like before...
>     > Hi Benajamin,
>     >
>     > As I gave in my previous code example dont use the line
>     > fac.createSOAPEnvelope (parser) to build the SOAP envelope.
>     >
>     > Use the method 'getSOAPEnvelope' of the StAXSOAPModelBuilder,
>     > Here it is again,
>     >
>     > String soap = "....";
>     > ByteArrayInputStream inStr = new
>     ByteArrayInputStream(soap.getBytes());
>     > SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
>     > StAXSOAPModelBuilder builder =
>     > OMXMLBuilderFactory.createStAXSOAPModelBuilder
>     >
>     > (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     > SOAPEnvelope env = builder.getSOAPEnvelope();
>     > client.sendReceive(env );
>     >
>     >
>     >
>     >
>     > Chamikara
>     >
>     >
>     > On 5/11/06, *Benjamin Schmeling* <Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     > <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>> wrote:
>     >
>     >     Hi,
>     >
>     >     String soap = "....";
>     >     ByteArrayInputStream inStr = new
>     >     ByteArrayInputStream(soap.getBytes());
>     >     SOAPFactory fac =   OMAbstractFactory.getSOAP11Factory();
>     >     StAXSOAPModelBuilder builder =
>     >     OMXMLBuilderFactory.createStAXSOAPModelBuilder
>     >    
>     (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     >     SOAPEnvelope env = builder.getSOAPEnvelope();
>     >     client.sendReceive(fac.createSOAPEnvelope (parser));
>     >
>     >     the last line throws the following exception:
>     >
>     >     org.apache.axiom.om.OMException : Root Element can not be
>     detached
>     >         at
>     >    
>     org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.detach(SOAPEnvelopeImpl.java:155)
>     >         at
>     >     org.apache.axiom.om.impl.llom.OMNodeImpl.setParent
>     >     (OMNodeImpl.java:117)
>     >         at
>     >    
>     org.apache.axiom.soap.impl.llom.SOAPElement.setParent(SOAPElement.java:74)
>     >         at
>     >     org.apache.axiom.om.impl.llom.OMElementImpl.addChild
>     (OMElementImpl.java:240)
>     >         at
>     >     org.apache.axiom.om.impl.llom.OMElementImpl.addChild
>     >     (OMElementImpl.java:197)
>     >         at
>     >     org.apache.axis2.client.ServiceClient.fillSoapEnvelope
>     (ServiceClient.java:554)
>     >         at
>     >    
>     org.apache.axis2.client.ServiceClient.sendReceiveNonBlocking(ServiceClient.java:467)
>     >         at
>     >     org.apache.axis2.client.ServiceClient.sendReceive
>     (ServiceClient.java:411)
>     >         at
>     >    
>     org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:394)
>     >
>     >     What does this mean?
>     >     > Hi Benjamin,
>     >     >
>     >     > Try following,
>     >     >
>     >     > String soap = "....";
>     >     > ByteArrayInputStream inStr = new
>     >     ByteArrayInputStream(soap.getBytes());
>     >     > SOAPFactory fac =   OMAbstractFactory.getSOAP11Factory();
>     >     > StAXSOAPModelBuilder builder =
>     >     >
>     >    
>     OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>
>     >     > SOAPEnvelope env = builder.getSOAPEnvelope();
>     >     >
>     >     >
>     >     >
>     >     > Chamikara
>     >     >
>     >     >
>     >     >
>     >     > On 5/10/06, *Benjamin Schmeling* <
>     Benjamin_Schmeling@gmx.de <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>
>     >     > <mailto: Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     >     <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>>> wrote:
>     >     >
>     >     >     Hi,
>     >     >
>     >     >     I want to write a Web Service which sends reliable SOAP
>     >     messages with
>     >     >     Sandesha2. My input is a SOAP message as String. The
>     problem
>     >     is that I
>     >     >     do not know how to transform this into an OMElement
>     that can
>     >     be sent
>     >     >     with the ServiceClient class.
>     >     >
>     >     >     I tried something like this but it did not work:
>     >     >
>     >     >     String soap = "....";
>     >     >     ByteArrayInputStream inStr = new
>     >     >     ByteArrayInputStream( soap.getBytes());
>     >     >     SOAPFactory fac =   OMAbstractFactory.getSOAP11Factory();
>     >     >     OMXMLParserWrapper parser =
>     >     >     OMXMLBuilderFactory.createStAXSOAPModelBuilder (fac,
>     >     >     XMLInputFactory.newInstance
>     ().createXMLStreamReader(inStr));
>     >     >     client.sendReceive(fac.createSOAPEnvelope (parser));
>     >     >
>     >     >     How can I get this working?
>     >     >
>     >     >     Thanks,
>     >     >
>     >     >     Benjamin
>     >     >
>     >     >
>     >     >
>     >    
>     ---------------------------------------------------------------------
>     >     >     To unsubscribe, e-mail:
>     >     sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>>
>     >     >     For additional commands, e-mail:
>     >     sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto: sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto: sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>>
>     >     >
>     >     >
>     >
>     >
>     >
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org


Re: Sending a custom SOAP message with Sandesha2

Posted by Chamikara Jayalath <ch...@gmail.com>.
Hi Benajamin,

There is not sendReveive method that takes a SOAP envelope as the parameter.
Instead what you should give is the payload of your SOAP envelope. If you
want to add headers there is a seperate 'adddHeader' method available.

If you are still getting the error, please send your full client code and
the String u use to generate the SOAP envelope, for me to reproduce the
error.


Chamikara


On 5/11/06, Benjamin Schmeling <Be...@gmx.de> wrote:
>
> Sorry my fault my code looks like this:
>
> ByteArrayInputStream inStr = new ByteArrayInputStream(soap.getBytes());
> SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
> StAXSOAPModelBuilder builder =
> OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,
> XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>
> SOAPEnvelope env = builder.getSOAPEnvelope();
> OMElement omReturn = client.sendReceive(env);
>
> But the same error like before...
> > Hi Benajamin,
> >
> > As I gave in my previous code example dont use the line
> > fac.createSOAPEnvelope (parser) to build the SOAP envelope.
> >
> > Use the method 'getSOAPEnvelope' of the StAXSOAPModelBuilder,
> > Here it is again,
> >
> > String soap = "....";
> > ByteArrayInputStream inStr = new ByteArrayInputStream(soap.getBytes());
> > SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
> > StAXSOAPModelBuilder builder =
> > OMXMLBuilderFactory.createStAXSOAPModelBuilder
> >
> > (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
> > SOAPEnvelope env = builder.getSOAPEnvelope();
> > client.sendReceive(env );
> >
> >
> >
> >
> > Chamikara
> >
> >
> > On 5/11/06, *Benjamin Schmeling* <Benjamin_Schmeling@gmx.de
> > <ma...@gmx.de>> wrote:
> >
> >     Hi,
> >
> >     String soap = "....";
> >     ByteArrayInputStream inStr = new
> >     ByteArrayInputStream(soap.getBytes());
> >     SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
> >     StAXSOAPModelBuilder builder =
> >     OMXMLBuilderFactory.createStAXSOAPModelBuilder
> >     (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
> >     SOAPEnvelope env = builder.getSOAPEnvelope();
> >     client.sendReceive(fac.createSOAPEnvelope (parser));
> >
> >     the last line throws the following exception:
> >
> >     org.apache.axiom.om.OMException: Root Element can not be detached
> >         at
> >     org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.detach(
> SOAPEnvelopeImpl.java:155)
> >         at
> >     org.apache.axiom.om.impl.llom.OMNodeImpl.setParent
> >     (OMNodeImpl.java:117)
> >         at
> >     org.apache.axiom.soap.impl.llom.SOAPElement.setParent(
> SOAPElement.java:74)
> >         at
> >     org.apache.axiom.om.impl.llom.OMElementImpl.addChild(
> OMElementImpl.java:240)
> >         at
> >     org.apache.axiom.om.impl.llom.OMElementImpl.addChild
> >     (OMElementImpl.java:197)
> >         at
> >     org.apache.axis2.client.ServiceClient.fillSoapEnvelope(
> ServiceClient.java:554)
> >         at
> >     org.apache.axis2.client.ServiceClient.sendReceiveNonBlocking(
> ServiceClient.java:467)
> >         at
> >     org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java
> :411)
> >         at
> >     org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java
> :394)
> >
> >     What does this mean?
> >     > Hi Benjamin,
> >     >
> >     > Try following,
> >     >
> >     > String soap = "....";
> >     > ByteArrayInputStream inStr = new
> >     ByteArrayInputStream(soap.getBytes());
> >     > SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
> >     > StAXSOAPModelBuilder builder =
> >     >
> >     OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,
> XMLInputFactory.newInstance().createXMLStreamReader(inStr));
> >     > SOAPEnvelope env = builder.getSOAPEnvelope();
> >     >
> >     >
> >     >
> >     > Chamikara
> >     >
> >     >
> >     >
> >     > On 5/10/06, *Benjamin Schmeling* <Benjamin_Schmeling@gmx.de
> >     <ma...@gmx.de>
> >     > <mailto:Benjamin_Schmeling@gmx.de
> >     <ma...@gmx.de>>> wrote:
> >     >
> >     >     Hi,
> >     >
> >     >     I want to write a Web Service which sends reliable SOAP
> >     messages with
> >     >     Sandesha2. My input is a SOAP message as String. The problem
> >     is that I
> >     >     do not know how to transform this into an OMElement that can
> >     be sent
> >     >     with the ServiceClient class.
> >     >
> >     >     I tried something like this but it did not work:
> >     >
> >     >     String soap = "....";
> >     >     ByteArrayInputStream inStr = new
> >     >     ByteArrayInputStream( soap.getBytes());
> >     >     SOAPFactory fac =   OMAbstractFactory.getSOAP11Factory();
> >     >     OMXMLParserWrapper parser =
> >     >     OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,
> >     >     XMLInputFactory.newInstance ().createXMLStreamReader(inStr));
> >     >     client.sendReceive(fac.createSOAPEnvelope (parser));
> >     >
> >     >     How can I get this working?
> >     >
> >     >     Thanks,
> >     >
> >     >     Benjamin
> >     >
> >     >
> >     >
> >
> ---------------------------------------------------------------------
> >     >     To unsubscribe, e-mail:
> >     sandesha-dev-unsubscribe@ws.apache.org
> >     <ma...@ws.apache.org>
> >     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
> >     <ma...@ws.apache.org>>
> >     >     For additional commands, e-mail:
> >     sandesha-dev-help@ws.apache.org
> >     <ma...@ws.apache.org>
> >     >     <mailto:sandesha-dev-help@ws.apache.org
> >     <ma...@ws.apache.org>>
> >     >
> >     >
> >
> >
> >
>
>
>

Re: Sending a custom SOAP message with Sandesha2

Posted by Chamikara Jayalath <ch...@gmail.com>.
Hi Benajamin,

There is not sendReveive method that takes a SOAP envelope as the parameter.
Instead what you should give is the payload of your SOAP envelope. If you
want to add headers there is a seperate 'adddHeader' method available.

If you are still getting the error, please send your full client code and
the String u use to generate the SOAP envelope, for me to reproduce the
error.


Chamikara


On 5/11/06, Benjamin Schmeling <Be...@gmx.de> wrote:
>
> Sorry my fault my code looks like this:
>
> ByteArrayInputStream inStr = new ByteArrayInputStream(soap.getBytes());
> SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
> StAXSOAPModelBuilder builder =
> OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,
> XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>
> SOAPEnvelope env = builder.getSOAPEnvelope();
> OMElement omReturn = client.sendReceive(env);
>
> But the same error like before...
> > Hi Benajamin,
> >
> > As I gave in my previous code example dont use the line
> > fac.createSOAPEnvelope (parser) to build the SOAP envelope.
> >
> > Use the method 'getSOAPEnvelope' of the StAXSOAPModelBuilder,
> > Here it is again,
> >
> > String soap = "....";
> > ByteArrayInputStream inStr = new ByteArrayInputStream(soap.getBytes());
> > SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
> > StAXSOAPModelBuilder builder =
> > OMXMLBuilderFactory.createStAXSOAPModelBuilder
> >
> > (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
> > SOAPEnvelope env = builder.getSOAPEnvelope();
> > client.sendReceive(env );
> >
> >
> >
> >
> > Chamikara
> >
> >
> > On 5/11/06, *Benjamin Schmeling* <Benjamin_Schmeling@gmx.de
> > <ma...@gmx.de>> wrote:
> >
> >     Hi,
> >
> >     String soap = "....";
> >     ByteArrayInputStream inStr = new
> >     ByteArrayInputStream(soap.getBytes());
> >     SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
> >     StAXSOAPModelBuilder builder =
> >     OMXMLBuilderFactory.createStAXSOAPModelBuilder
> >     (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
> >     SOAPEnvelope env = builder.getSOAPEnvelope();
> >     client.sendReceive(fac.createSOAPEnvelope (parser));
> >
> >     the last line throws the following exception:
> >
> >     org.apache.axiom.om.OMException: Root Element can not be detached
> >         at
> >     org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.detach(
> SOAPEnvelopeImpl.java:155)
> >         at
> >     org.apache.axiom.om.impl.llom.OMNodeImpl.setParent
> >     (OMNodeImpl.java:117)
> >         at
> >     org.apache.axiom.soap.impl.llom.SOAPElement.setParent(
> SOAPElement.java:74)
> >         at
> >     org.apache.axiom.om.impl.llom.OMElementImpl.addChild(
> OMElementImpl.java:240)
> >         at
> >     org.apache.axiom.om.impl.llom.OMElementImpl.addChild
> >     (OMElementImpl.java:197)
> >         at
> >     org.apache.axis2.client.ServiceClient.fillSoapEnvelope(
> ServiceClient.java:554)
> >         at
> >     org.apache.axis2.client.ServiceClient.sendReceiveNonBlocking(
> ServiceClient.java:467)
> >         at
> >     org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java
> :411)
> >         at
> >     org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java
> :394)
> >
> >     What does this mean?
> >     > Hi Benjamin,
> >     >
> >     > Try following,
> >     >
> >     > String soap = "....";
> >     > ByteArrayInputStream inStr = new
> >     ByteArrayInputStream(soap.getBytes());
> >     > SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
> >     > StAXSOAPModelBuilder builder =
> >     >
> >     OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,
> XMLInputFactory.newInstance().createXMLStreamReader(inStr));
> >     > SOAPEnvelope env = builder.getSOAPEnvelope();
> >     >
> >     >
> >     >
> >     > Chamikara
> >     >
> >     >
> >     >
> >     > On 5/10/06, *Benjamin Schmeling* <Benjamin_Schmeling@gmx.de
> >     <ma...@gmx.de>
> >     > <mailto:Benjamin_Schmeling@gmx.de
> >     <ma...@gmx.de>>> wrote:
> >     >
> >     >     Hi,
> >     >
> >     >     I want to write a Web Service which sends reliable SOAP
> >     messages with
> >     >     Sandesha2. My input is a SOAP message as String. The problem
> >     is that I
> >     >     do not know how to transform this into an OMElement that can
> >     be sent
> >     >     with the ServiceClient class.
> >     >
> >     >     I tried something like this but it did not work:
> >     >
> >     >     String soap = "....";
> >     >     ByteArrayInputStream inStr = new
> >     >     ByteArrayInputStream( soap.getBytes());
> >     >     SOAPFactory fac =   OMAbstractFactory.getSOAP11Factory();
> >     >     OMXMLParserWrapper parser =
> >     >     OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,
> >     >     XMLInputFactory.newInstance ().createXMLStreamReader(inStr));
> >     >     client.sendReceive(fac.createSOAPEnvelope (parser));
> >     >
> >     >     How can I get this working?
> >     >
> >     >     Thanks,
> >     >
> >     >     Benjamin
> >     >
> >     >
> >     >
> >
> ---------------------------------------------------------------------
> >     >     To unsubscribe, e-mail:
> >     sandesha-dev-unsubscribe@ws.apache.org
> >     <ma...@ws.apache.org>
> >     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
> >     <ma...@ws.apache.org>>
> >     >     For additional commands, e-mail:
> >     sandesha-dev-help@ws.apache.org
> >     <ma...@ws.apache.org>
> >     >     <mailto:sandesha-dev-help@ws.apache.org
> >     <ma...@ws.apache.org>>
> >     >
> >     >
> >
> >
> >
>
>
>

Re: Sending a custom SOAP message with Sandesha2

Posted by Benjamin Schmeling <Be...@gmx.de>.
Sorry my fault my code looks like this:

ByteArrayInputStream inStr = new ByteArrayInputStream(soap.getBytes());
SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
StAXSOAPModelBuilder builder =   
OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr)); 

SOAPEnvelope env = builder.getSOAPEnvelope();
OMElement omReturn = client.sendReceive(env);

But the same error like before...
> Hi Benajamin,
>
> As I gave in my previous code example dont use the line
> fac.createSOAPEnvelope (parser) to build the SOAP envelope.
>
> Use the method 'getSOAPEnvelope' of the StAXSOAPModelBuilder,
> Here it is again,
>
> String soap = "....";
> ByteArrayInputStream inStr = new ByteArrayInputStream(soap.getBytes());
> SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
> StAXSOAPModelBuilder builder = 
> OMXMLBuilderFactory.createStAXSOAPModelBuilder   
>                                            
> (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
> SOAPEnvelope env = builder.getSOAPEnvelope();
> client.sendReceive(env );
>
>
>
>
> Chamikara
>
>
> On 5/11/06, *Benjamin Schmeling* <Benjamin_Schmeling@gmx.de 
> <ma...@gmx.de>> wrote:
>
>     Hi,
>
>     String soap = "....";
>     ByteArrayInputStream inStr = new
>     ByteArrayInputStream(soap.getBytes());
>     SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
>     StAXSOAPModelBuilder builder =
>     OMXMLBuilderFactory.createStAXSOAPModelBuilder
>     (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     SOAPEnvelope env = builder.getSOAPEnvelope();
>     client.sendReceive(fac.createSOAPEnvelope (parser));
>
>     the last line throws the following exception:
>
>     org.apache.axiom.om.OMException: Root Element can not be detached
>         at
>     org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.detach(SOAPEnvelopeImpl.java:155)
>         at
>     org.apache.axiom.om.impl.llom.OMNodeImpl.setParent
>     (OMNodeImpl.java:117)
>         at
>     org.apache.axiom.soap.impl.llom.SOAPElement.setParent(SOAPElement.java:74)
>         at
>     org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java:240)
>         at
>     org.apache.axiom.om.impl.llom.OMElementImpl.addChild
>     (OMElementImpl.java:197)
>         at
>     org.apache.axis2.client.ServiceClient.fillSoapEnvelope(ServiceClient.java:554)
>         at
>     org.apache.axis2.client.ServiceClient.sendReceiveNonBlocking(ServiceClient.java:467)
>         at
>     org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:411)
>         at
>     org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:394)
>
>     What does this mean?
>     > Hi Benjamin,
>     >
>     > Try following,
>     >
>     > String soap = "....";
>     > ByteArrayInputStream inStr = new
>     ByteArrayInputStream(soap.getBytes());
>     > SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
>     > StAXSOAPModelBuilder builder =
>     >
>     OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     > SOAPEnvelope env = builder.getSOAPEnvelope();
>     >
>     >
>     >
>     > Chamikara
>     >
>     >
>     >
>     > On 5/10/06, *Benjamin Schmeling* <Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     > <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>> wrote:
>     >
>     >     Hi,
>     >
>     >     I want to write a Web Service which sends reliable SOAP
>     messages with
>     >     Sandesha2. My input is a SOAP message as String. The problem
>     is that I
>     >     do not know how to transform this into an OMElement that can
>     be sent
>     >     with the ServiceClient class.
>     >
>     >     I tried something like this but it did not work:
>     >
>     >     String soap = "....";
>     >     ByteArrayInputStream inStr = new
>     >     ByteArrayInputStream( soap.getBytes());
>     >     SOAPFactory fac =   OMAbstractFactory.getSOAP11Factory();
>     >     OMXMLParserWrapper parser =
>     >     OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,
>     >     XMLInputFactory.newInstance ().createXMLStreamReader(inStr));
>     >     client.sendReceive(fac.createSOAPEnvelope (parser));
>     >
>     >     How can I get this working?
>     >
>     >     Thanks,
>     >
>     >     Benjamin
>     >
>     >
>     >    
>     ---------------------------------------------------------------------
>     >     To unsubscribe, e-mail:
>     sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     For additional commands, e-mail:
>     sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>
>     >
>     >
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org


Re: Sending a custom SOAP message with Sandesha2

Posted by Benjamin Schmeling <Be...@gmx.de>.
Sorry my fault my code looks like this:

ByteArrayInputStream inStr = new ByteArrayInputStream(soap.getBytes());
SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
StAXSOAPModelBuilder builder =   
OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr)); 

SOAPEnvelope env = builder.getSOAPEnvelope();
OMElement omReturn = client.sendReceive(env);

But the same error like before...
> Hi Benajamin,
>
> As I gave in my previous code example dont use the line
> fac.createSOAPEnvelope (parser) to build the SOAP envelope.
>
> Use the method 'getSOAPEnvelope' of the StAXSOAPModelBuilder,
> Here it is again,
>
> String soap = "....";
> ByteArrayInputStream inStr = new ByteArrayInputStream(soap.getBytes());
> SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
> StAXSOAPModelBuilder builder = 
> OMXMLBuilderFactory.createStAXSOAPModelBuilder   
>                                            
> (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
> SOAPEnvelope env = builder.getSOAPEnvelope();
> client.sendReceive(env );
>
>
>
>
> Chamikara
>
>
> On 5/11/06, *Benjamin Schmeling* <Benjamin_Schmeling@gmx.de 
> <ma...@gmx.de>> wrote:
>
>     Hi,
>
>     String soap = "....";
>     ByteArrayInputStream inStr = new
>     ByteArrayInputStream(soap.getBytes());
>     SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
>     StAXSOAPModelBuilder builder =
>     OMXMLBuilderFactory.createStAXSOAPModelBuilder
>     (fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     SOAPEnvelope env = builder.getSOAPEnvelope();
>     client.sendReceive(fac.createSOAPEnvelope (parser));
>
>     the last line throws the following exception:
>
>     org.apache.axiom.om.OMException: Root Element can not be detached
>         at
>     org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.detach(SOAPEnvelopeImpl.java:155)
>         at
>     org.apache.axiom.om.impl.llom.OMNodeImpl.setParent
>     (OMNodeImpl.java:117)
>         at
>     org.apache.axiom.soap.impl.llom.SOAPElement.setParent(SOAPElement.java:74)
>         at
>     org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java:240)
>         at
>     org.apache.axiom.om.impl.llom.OMElementImpl.addChild
>     (OMElementImpl.java:197)
>         at
>     org.apache.axis2.client.ServiceClient.fillSoapEnvelope(ServiceClient.java:554)
>         at
>     org.apache.axis2.client.ServiceClient.sendReceiveNonBlocking(ServiceClient.java:467)
>         at
>     org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:411)
>         at
>     org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:394)
>
>     What does this mean?
>     > Hi Benjamin,
>     >
>     > Try following,
>     >
>     > String soap = "....";
>     > ByteArrayInputStream inStr = new
>     ByteArrayInputStream(soap.getBytes());
>     > SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
>     > StAXSOAPModelBuilder builder =
>     >
>     OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     > SOAPEnvelope env = builder.getSOAPEnvelope();
>     >
>     >
>     >
>     > Chamikara
>     >
>     >
>     >
>     > On 5/10/06, *Benjamin Schmeling* <Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>
>     > <mailto:Benjamin_Schmeling@gmx.de
>     <ma...@gmx.de>>> wrote:
>     >
>     >     Hi,
>     >
>     >     I want to write a Web Service which sends reliable SOAP
>     messages with
>     >     Sandesha2. My input is a SOAP message as String. The problem
>     is that I
>     >     do not know how to transform this into an OMElement that can
>     be sent
>     >     with the ServiceClient class.
>     >
>     >     I tried something like this but it did not work:
>     >
>     >     String soap = "....";
>     >     ByteArrayInputStream inStr = new
>     >     ByteArrayInputStream( soap.getBytes());
>     >     SOAPFactory fac =   OMAbstractFactory.getSOAP11Factory();
>     >     OMXMLParserWrapper parser =
>     >     OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,
>     >     XMLInputFactory.newInstance ().createXMLStreamReader(inStr));
>     >     client.sendReceive(fac.createSOAPEnvelope (parser));
>     >
>     >     How can I get this working?
>     >
>     >     Thanks,
>     >
>     >     Benjamin
>     >
>     >
>     >    
>     ---------------------------------------------------------------------
>     >     To unsubscribe, e-mail:
>     sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     For additional commands, e-mail:
>     sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>>
>     >
>     >
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org


Re: Sending a custom SOAP message with Sandesha2

Posted by Chamikara Jayalath <ch...@gmail.com>.
Hi Benajamin,

As I gave in my previous code example dont use the line
fac.createSOAPEnvelope (parser) to build the SOAP envelope.

Use the method 'getSOAPEnvelope' of the StAXSOAPModelBuilder,
Here it is again,

String soap = "....";
ByteArrayInputStream inStr = new ByteArrayInputStream(soap.getBytes());
SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
StAXSOAPModelBuilder builder =
OMXMLBuilderFactory.createStAXSOAPModelBuilder
                                           (fac,XMLInputFactory.newInstance
().createXMLStreamReader(inStr));
SOAPEnvelope env = builder.getSOAPEnvelope();
client.sendReceive(env );




Chamikara


On 5/11/06, Benjamin Schmeling <Be...@gmx.de> wrote:
>
> Hi,
>
> String soap = "....";
> ByteArrayInputStream inStr = new ByteArrayInputStream(soap.getBytes());
> SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
> StAXSOAPModelBuilder builder =
> OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,
> XMLInputFactory.newInstance().createXMLStreamReader(inStr));
> SOAPEnvelope env = builder.getSOAPEnvelope();
> client.sendReceive(fac.createSOAPEnvelope (parser));
>
> the last line throws the following exception:
>
> org.apache.axiom.om.OMException: Root Element can not be detached
>     at
> org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.detach(
> SOAPEnvelopeImpl.java:155)
>     at
> org.apache.axiom.om.impl.llom.OMNodeImpl.setParent(OMNodeImpl.java:117)
>     at
> org.apache.axiom.soap.impl.llom.SOAPElement.setParent(SOAPElement.java:74)
>     at
> org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java
> :240)
>     at
> org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java
> :197)
>     at
> org.apache.axis2.client.ServiceClient.fillSoapEnvelope(ServiceClient.java
> :554)
>     at
> org.apache.axis2.client.ServiceClient.sendReceiveNonBlocking(
> ServiceClient.java:467)
>     at
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:411)
>     at
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:394)
>
> What does this mean?
> > Hi Benjamin,
> >
> > Try following,
> >
> > String soap = "....";
> > ByteArrayInputStream inStr = new ByteArrayInputStream(soap.getBytes());
> > SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
> > StAXSOAPModelBuilder builder =
> > OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,
> XMLInputFactory.newInstance().createXMLStreamReader(inStr));
> > SOAPEnvelope env = builder.getSOAPEnvelope();
> >
> >
> >
> > Chamikara
> >
> >
> >
> > On 5/10/06, *Benjamin Schmeling* <Benjamin_Schmeling@gmx.de
> > <ma...@gmx.de>> wrote:
> >
> >     Hi,
> >
> >     I want to write a Web Service which sends reliable SOAP messages
> with
> >     Sandesha2. My input is a SOAP message as String. The problem is that
> I
> >     do not know how to transform this into an OMElement that can be sent
> >     with the ServiceClient class.
> >
> >     I tried something like this but it did not work:
> >
> >     String soap = "....";
> >     ByteArrayInputStream inStr = new
> >     ByteArrayInputStream(soap.getBytes());
> >     SOAPFactory fac =   OMAbstractFactory.getSOAP11Factory();
> >     OMXMLParserWrapper parser =
> >     OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,
> >     XMLInputFactory.newInstance().createXMLStreamReader(inStr));
> >     client.sendReceive(fac.createSOAPEnvelope (parser));
> >
> >     How can I get this working?
> >
> >     Thanks,
> >
> >     Benjamin
> >
> >
> >
> ---------------------------------------------------------------------
> >     To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
> >     <ma...@ws.apache.org>
> >     For additional commands, e-mail: sandesha-dev-help@ws.apache.org
> >     <ma...@ws.apache.org>
> >
> >
>
>
>

Re: Sending a custom SOAP message with Sandesha2

Posted by Chamikara Jayalath <ch...@gmail.com>.
Hi Benajamin,

As I gave in my previous code example dont use the line
fac.createSOAPEnvelope (parser) to build the SOAP envelope.

Use the method 'getSOAPEnvelope' of the StAXSOAPModelBuilder,
Here it is again,

String soap = "....";
ByteArrayInputStream inStr = new ByteArrayInputStream(soap.getBytes());
SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
StAXSOAPModelBuilder builder =
OMXMLBuilderFactory.createStAXSOAPModelBuilder
                                           (fac,XMLInputFactory.newInstance
().createXMLStreamReader(inStr));
SOAPEnvelope env = builder.getSOAPEnvelope();
client.sendReceive(env );




Chamikara


On 5/11/06, Benjamin Schmeling <Be...@gmx.de> wrote:
>
> Hi,
>
> String soap = "....";
> ByteArrayInputStream inStr = new ByteArrayInputStream(soap.getBytes());
> SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
> StAXSOAPModelBuilder builder =
> OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,
> XMLInputFactory.newInstance().createXMLStreamReader(inStr));
> SOAPEnvelope env = builder.getSOAPEnvelope();
> client.sendReceive(fac.createSOAPEnvelope (parser));
>
> the last line throws the following exception:
>
> org.apache.axiom.om.OMException: Root Element can not be detached
>     at
> org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.detach(
> SOAPEnvelopeImpl.java:155)
>     at
> org.apache.axiom.om.impl.llom.OMNodeImpl.setParent(OMNodeImpl.java:117)
>     at
> org.apache.axiom.soap.impl.llom.SOAPElement.setParent(SOAPElement.java:74)
>     at
> org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java
> :240)
>     at
> org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java
> :197)
>     at
> org.apache.axis2.client.ServiceClient.fillSoapEnvelope(ServiceClient.java
> :554)
>     at
> org.apache.axis2.client.ServiceClient.sendReceiveNonBlocking(
> ServiceClient.java:467)
>     at
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:411)
>     at
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:394)
>
> What does this mean?
> > Hi Benjamin,
> >
> > Try following,
> >
> > String soap = "....";
> > ByteArrayInputStream inStr = new ByteArrayInputStream(soap.getBytes());
> > SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
> > StAXSOAPModelBuilder builder =
> > OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,
> XMLInputFactory.newInstance().createXMLStreamReader(inStr));
> > SOAPEnvelope env = builder.getSOAPEnvelope();
> >
> >
> >
> > Chamikara
> >
> >
> >
> > On 5/10/06, *Benjamin Schmeling* <Benjamin_Schmeling@gmx.de
> > <ma...@gmx.de>> wrote:
> >
> >     Hi,
> >
> >     I want to write a Web Service which sends reliable SOAP messages
> with
> >     Sandesha2. My input is a SOAP message as String. The problem is that
> I
> >     do not know how to transform this into an OMElement that can be sent
> >     with the ServiceClient class.
> >
> >     I tried something like this but it did not work:
> >
> >     String soap = "....";
> >     ByteArrayInputStream inStr = new
> >     ByteArrayInputStream(soap.getBytes());
> >     SOAPFactory fac =   OMAbstractFactory.getSOAP11Factory();
> >     OMXMLParserWrapper parser =
> >     OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,
> >     XMLInputFactory.newInstance().createXMLStreamReader(inStr));
> >     client.sendReceive(fac.createSOAPEnvelope (parser));
> >
> >     How can I get this working?
> >
> >     Thanks,
> >
> >     Benjamin
> >
> >
> >
> ---------------------------------------------------------------------
> >     To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
> >     <ma...@ws.apache.org>
> >     For additional commands, e-mail: sandesha-dev-help@ws.apache.org
> >     <ma...@ws.apache.org>
> >
> >
>
>
>

Re: Sending a custom SOAP message with Sandesha2

Posted by Benjamin Schmeling <Be...@gmx.de>.
Hi,

String soap = "....";
ByteArrayInputStream inStr = new ByteArrayInputStream(soap.getBytes());
SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
StAXSOAPModelBuilder builder =   
OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
SOAPEnvelope env = builder.getSOAPEnvelope();
client.sendReceive(fac.createSOAPEnvelope (parser));

the last line throws the following exception:

org.apache.axiom.om.OMException: Root Element can not be detached
    at 
org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.detach(SOAPEnvelopeImpl.java:155)
    at 
org.apache.axiom.om.impl.llom.OMNodeImpl.setParent(OMNodeImpl.java:117)
    at 
org.apache.axiom.soap.impl.llom.SOAPElement.setParent(SOAPElement.java:74)
    at 
org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java:240)
    at 
org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java:197)
    at 
org.apache.axis2.client.ServiceClient.fillSoapEnvelope(ServiceClient.java:554)
    at 
org.apache.axis2.client.ServiceClient.sendReceiveNonBlocking(ServiceClient.java:467)
    at 
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:411)
    at 
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:394)

What does this mean?
> Hi Benjamin,
>
> Try following,
>
> String soap = "....";
> ByteArrayInputStream inStr = new ByteArrayInputStream(soap.getBytes());
> SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
> StAXSOAPModelBuilder builder =   
> OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
> SOAPEnvelope env = builder.getSOAPEnvelope();
>
>
>
> Chamikara
>
>
>
> On 5/10/06, *Benjamin Schmeling* <Benjamin_Schmeling@gmx.de 
> <ma...@gmx.de>> wrote:
>
>     Hi,
>
>     I want to write a Web Service which sends reliable SOAP messages with
>     Sandesha2. My input is a SOAP message as String. The problem is that I
>     do not know how to transform this into an OMElement that can be sent
>     with the ServiceClient class.
>
>     I tried something like this but it did not work:
>
>     String soap = "....";
>     ByteArrayInputStream inStr = new
>     ByteArrayInputStream(soap.getBytes());
>     SOAPFactory fac =   OMAbstractFactory.getSOAP11Factory();
>     OMXMLParserWrapper parser =
>     OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,
>     XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     client.sendReceive(fac.createSOAPEnvelope (parser));
>
>     How can I get this working?
>
>     Thanks,
>
>     Benjamin
>
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     For additional commands, e-mail: sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org


Re: Sending a custom SOAP message with Sandesha2

Posted by Benjamin Schmeling <Be...@gmx.de>.
Hi,

String soap = "....";
ByteArrayInputStream inStr = new ByteArrayInputStream(soap.getBytes());
SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
StAXSOAPModelBuilder builder =   
OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
SOAPEnvelope env = builder.getSOAPEnvelope();
client.sendReceive(fac.createSOAPEnvelope (parser));

the last line throws the following exception:

org.apache.axiom.om.OMException: Root Element can not be detached
    at 
org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.detach(SOAPEnvelopeImpl.java:155)
    at 
org.apache.axiom.om.impl.llom.OMNodeImpl.setParent(OMNodeImpl.java:117)
    at 
org.apache.axiom.soap.impl.llom.SOAPElement.setParent(SOAPElement.java:74)
    at 
org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java:240)
    at 
org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java:197)
    at 
org.apache.axis2.client.ServiceClient.fillSoapEnvelope(ServiceClient.java:554)
    at 
org.apache.axis2.client.ServiceClient.sendReceiveNonBlocking(ServiceClient.java:467)
    at 
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:411)
    at 
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:394)

What does this mean?
> Hi Benjamin,
>
> Try following,
>
> String soap = "....";
> ByteArrayInputStream inStr = new ByteArrayInputStream(soap.getBytes());
> SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
> StAXSOAPModelBuilder builder =   
> OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,XMLInputFactory.newInstance().createXMLStreamReader(inStr));
> SOAPEnvelope env = builder.getSOAPEnvelope();
>
>
>
> Chamikara
>
>
>
> On 5/10/06, *Benjamin Schmeling* <Benjamin_Schmeling@gmx.de 
> <ma...@gmx.de>> wrote:
>
>     Hi,
>
>     I want to write a Web Service which sends reliable SOAP messages with
>     Sandesha2. My input is a SOAP message as String. The problem is that I
>     do not know how to transform this into an OMElement that can be sent
>     with the ServiceClient class.
>
>     I tried something like this but it did not work:
>
>     String soap = "....";
>     ByteArrayInputStream inStr = new
>     ByteArrayInputStream(soap.getBytes());
>     SOAPFactory fac =   OMAbstractFactory.getSOAP11Factory();
>     OMXMLParserWrapper parser =
>     OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,
>     XMLInputFactory.newInstance().createXMLStreamReader(inStr));
>     client.sendReceive(fac.createSOAPEnvelope (parser));
>
>     How can I get this working?
>
>     Thanks,
>
>     Benjamin
>
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     For additional commands, e-mail: sandesha-dev-help@ws.apache.org
>     <ma...@ws.apache.org>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org


Re: Sending a custom SOAP message with Sandesha2

Posted by Chamikara Jayalath <ch...@gmail.com>.
Hi Benjamin,

Try following,

String soap = "....";
ByteArrayInputStream inStr = new ByteArrayInputStream(soap.getBytes());
SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
StAXSOAPModelBuilder builder =
OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,
XMLInputFactory.newInstance().createXMLStreamReader(inStr));
SOAPEnvelope env = builder.getSOAPEnvelope();



Chamikara



On 5/10/06, Benjamin Schmeling <Be...@gmx.de> wrote:
>
> Hi,
>
> I want to write a Web Service which sends reliable SOAP messages with
> Sandesha2. My input is a SOAP message as String. The problem is that I
> do not know how to transform this into an OMElement that can be sent
> with the ServiceClient class.
>
> I tried something like this but it did not work:
>
> String soap = "....";
> ByteArrayInputStream inStr = new ByteArrayInputStream(soap.getBytes());
> SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
> OMXMLParserWrapper parser =
> OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,
> XMLInputFactory.newInstance().createXMLStreamReader(inStr));
> client.sendReceive(fac.createSOAPEnvelope(parser));
>
> How can I get this working?
>
> Thanks,
>
> Benjamin
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: sandesha-dev-help@ws.apache.org
>
>

Re: Sending a custom SOAP message with Sandesha2

Posted by Chamikara Jayalath <ch...@gmail.com>.
Hi Benjamin,

Try following,

String soap = "....";
ByteArrayInputStream inStr = new ByteArrayInputStream(soap.getBytes());
SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
StAXSOAPModelBuilder builder =
OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,
XMLInputFactory.newInstance().createXMLStreamReader(inStr));
SOAPEnvelope env = builder.getSOAPEnvelope();



Chamikara



On 5/10/06, Benjamin Schmeling <Be...@gmx.de> wrote:
>
> Hi,
>
> I want to write a Web Service which sends reliable SOAP messages with
> Sandesha2. My input is a SOAP message as String. The problem is that I
> do not know how to transform this into an OMElement that can be sent
> with the ServiceClient class.
>
> I tried something like this but it did not work:
>
> String soap = "....";
> ByteArrayInputStream inStr = new ByteArrayInputStream(soap.getBytes());
> SOAPFactory fac =  OMAbstractFactory.getSOAP11Factory();
> OMXMLParserWrapper parser =
> OMXMLBuilderFactory.createStAXSOAPModelBuilder(fac,
> XMLInputFactory.newInstance().createXMLStreamReader(inStr));
> client.sendReceive(fac.createSOAPEnvelope(parser));
>
> How can I get this working?
>
> Thanks,
>
> Benjamin
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: sandesha-dev-help@ws.apache.org
>
>