You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@synapse.apache.org by Garth Patil <ga...@gmail.com> on 2008/05/01 23:34:56 UTC

Eliminating soap envelope from XML

Hi All,
I'm using synapse to proxy a web service that uses XML over HTTP. My
configuration looks like this:
<definitions xmlns= "http://ws.apache.org/ns/synapse">
  <proxy name="TestProxy">
    <target>
      <endpoint>
        <address uri="http://someremoteservice.com/msg" format="pox" />
      </endpoint>
      <inSequence>
        <log level= "full" />
      </inSequence>
      <outSequence>
        <log level= "full" />
        <send />
      </outSequence>
    </target>
  </proxy>
</definitions>

I post XML to localhost:8080/soap/TestProxy, and synapse passes it to
the specified endpoint without changing it. The remote service returns
XML which is wrapped in soapenv:Body and soapenv:Envelope tags. Is
there a way to specify that the response (like the request) remain
unadulterated by SOAP tags?
Thanks,
Garth

Re: Eliminating soap envelope from XML

Posted by "Asankha C. Perera" <as...@wso2.com>.

Garth Patil wrote:
> Thanks Ashanka. Must a client support HTTP/1.1 chunking in order to use synapse?
>   
No.. but if it supports HTTP 1.1, Synapse will use chunking unless its 
forced (or rather 'configued') to only use HTTP 1.0

asankha

Re: Eliminating soap envelope from XML

Posted by Garth Patil <ga...@gmail.com>.
Thanks Ashanka. Must a client support HTTP/1.1 chunking in order to use synapse?
Best,
Garth

On Mon, May 5, 2008 at 10:13 AM, Asankha C. Perera <as...@wso2.com> wrote:
> Garth
>
>
> > 2df
> > <ns:getQuoteResponse xmlns:ns="http://services.samples/xsd"><ns:return
> >
> type="samples.services.GetQuoteResponse"><ns:change>-2.8645613863894557</ns:change><ns
> >
> :earnings>12.30521720248757</ns:earnings><ns:high>-151.78678259858341</ns:high><ns:last>154.53038305767686</ns:last><ns:lastTradeTimestamp>Sat
> > May 03 18:55:1
> > 7 PDT
> 2008</ns:lastTradeTimestamp><ns:low>160.3361975912104</ns:low><ns:marketCap>-358967.49623407796</ns:marketCap><ns:name>IBM
> > Company</ns:name><ns:open>15
> >
> 9.5352172771564</ns:open><ns:peRatio>25.471190753873586</ns:peRatio><ns:percentageChange>-1.7026538696082525</ns:percentageChange><ns:prevClose>168.240970024
> >
> 54968</ns:prevClose><ns:symbol>IBM</ns:symbol><ns:volume>5145</ns:volume></ns:return></ns:getQuoteResponse>
> > 0
> >
> >
> > ==============
> >
> > Note the "2df" before the response xml and the "0" after. Is anyone
> > seeing the same thing? Any ideas where that is from? I've attached a
> > JMeter test that I used to call the service. Note that the "View
> > Results Tree" listener cannot render the xml after executing the test.
> >
> >
>  The "2df" and "0" are the sizes of the "chunks" sent, as this is using HTTP
> chunking (available with HTTP 1.1) to perform better streaming. If you do
> not "chunk", an HTTP message must write its size as the "Content-Length"
> header, which basically requires you to buffer the message into memory to
> find out how many bytes it will spread to
>
>  Chunking is harmless, and good in performance, and will not have *any* bad
> effect on anything else whatsoever AFAIK
>
>  asankha
>

Re: Eliminating soap envelope from XML

Posted by "Asankha C. Perera" <as...@wso2.com>.
Garth
> 2df
> <ns:getQuoteResponse xmlns:ns="http://services.samples/xsd"><ns:return
> type="samples.services.GetQuoteResponse"><ns:change>-2.8645613863894557</ns:change><ns
> :earnings>12.30521720248757</ns:earnings><ns:high>-151.78678259858341</ns:high><ns:last>154.53038305767686</ns:last><ns:lastTradeTimestamp>Sat
> May 03 18:55:1
> 7 PDT 2008</ns:lastTradeTimestamp><ns:low>160.3361975912104</ns:low><ns:marketCap>-358967.49623407796</ns:marketCap><ns:name>IBM
> Company</ns:name><ns:open>15
> 9.5352172771564</ns:open><ns:peRatio>25.471190753873586</ns:peRatio><ns:percentageChange>-1.7026538696082525</ns:percentageChange><ns:prevClose>168.240970024
> 54968</ns:prevClose><ns:symbol>IBM</ns:symbol><ns:volume>5145</ns:volume></ns:return></ns:getQuoteResponse>
> 0
>
>
> ==============
>
> Note the "2df" before the response xml and the "0" after. Is anyone
> seeing the same thing? Any ideas where that is from? I've attached a
> JMeter test that I used to call the service. Note that the "View
> Results Tree" listener cannot render the xml after executing the test.
>   
The "2df" and "0" are the sizes of the "chunks" sent, as this is using 
HTTP chunking (available with HTTP 1.1) to perform better streaming. If 
you do not "chunk", an HTTP message must write its size as the 
"Content-Length" header, which basically requires you to buffer the 
message into memory to find out how many bytes it will spread to

Chunking is harmless, and good in performance, and will not have *any* 
bad effect on anything else whatsoever AFAIK

asankha

Re: Eliminating soap envelope from XML

Posted by Garth Patil <ga...@gmail.com>.
Hi All,
The addition of the "Content-Type: application/xml" header seems to
make synapse behave as expected. Thanks for all of your help. However,
I'm having trouble using an xml parser on the client end because of
some additional characters in the response. Here is the tcpmon output:

==============
Listen Port: 8888
Target Host: 127.0.0.1
Target Port: 8080
==== Request ====
POST /soap/StockQuote HTTP/1.1
Connection: close
Content-Type: application/xml
User-Agent: Jakarta Commons-HttpClient/3.1
Host: 127.0.0.1:8888
Content-Length: 91

<m0:getQuote xmlns:m0="http://services.samples/xsd"><m0:requol></m0:request></m0:getQuote>
==== Response ====
HTTP/1.1 200 OK
Content-Type: application/xml; charset=UTF-8
X-Powered-By: PHP/5.2.5
Keep-Alive: timeout=5, max=100
Vary: Accept,Accept-Encoding
Date: Mon, 05 May 2008 16:54:31 GMT
Server: Synapse-HttpComponents-NIO
Transfer-Encoding: chunked
Connection: close

2df
<ns:getQuoteResponse xmlns:ns="http://services.samples/xsd"><ns:return
type="samples.services.GetQuoteResponse"><ns:change>-2.8645613863894557</ns:change><ns
:earnings>12.30521720248757</ns:earnings><ns:high>-151.78678259858341</ns:high><ns:last>154.53038305767686</ns:last><ns:lastTradeTimestamp>Sat
May 03 18:55:1
7 PDT 2008</ns:lastTradeTimestamp><ns:low>160.3361975912104</ns:low><ns:marketCap>-358967.49623407796</ns:marketCap><ns:name>IBM
Company</ns:name><ns:open>15
9.5352172771564</ns:open><ns:peRatio>25.471190753873586</ns:peRatio><ns:percentageChange>-1.7026538696082525</ns:percentageChange><ns:prevClose>168.240970024
54968</ns:prevClose><ns:symbol>IBM</ns:symbol><ns:volume>5145</ns:volume></ns:return></ns:getQuoteResponse>
0


==============

Note the "2df" before the response xml and the "0" after. Is anyone
seeing the same thing? Any ideas where that is from? I've attached a
JMeter test that I used to call the service. Note that the "View
Results Tree" listener cannot render the xml after executing the test.
Thanks again,
Garth


On Sun, May 4, 2008 at 10:05 AM, Asankha C. Perera <as...@wso2.com> wrote:
> Garth
>
>  It seems like Synapse "detects" the initial request it passes to your
> service as SOAP! This should be because of the 'Content-type' used by that
> message. Any possibility for you to use TCPMon
> (http://ws.apache.org/commons/tcpmon/) to capture this request with the HTTP
> headers etc?
>
>  This is why you are required to use format="pox".. since if it was
> 'detected' as POX/REST, this would not have been necessary
>
>  asankha
>
>

Re: Eliminating soap envelope from XML

Posted by "Asankha C. Perera" <as...@wso2.com>.
Garth

It seems like Synapse "detects" the initial request it passes to your 
service as SOAP! This should be because of the 'Content-type' used by 
that message. Any possibility for you to use TCPMon 
(http://ws.apache.org/commons/tcpmon/) to capture this request with the 
HTTP headers etc?

This is why you are required to use format="pox".. since if it was 
'detected' as POX/REST, this would not have been necessary

asankha


Re: Eliminating soap envelope from XML

Posted by Ruwan Linton <ru...@gmail.com>.
Hi Garth,

I tried the PHP simulation that you have hosted with curl as the client. It
didn't give me errors on the build of a svn trunk, but it didn't respond the
message as well. Then I found the issue being not sending the HTTP
Content-Type so I used the following command, and it worked for me. Could
you please have a look at it.

curl -d "<m0:getQuote
xmlns:m0=\"http://services.samples/xsd\"><m0:requol></m0:request></m0:getQuote>"
-H "Content-Type: application/xml" http://localhost:8080/soap/StockQuote

For the completion here is the configuration that I used.

<definitions xmlns="http://ws.apache.org/ns/synapse">
    <filter source="get-property('To')" regex=".*/StockQuote.*">
        <send>
            <endpoint>
               <address uri="http://tunnel19.com/synapseStockQuote.php"/>
            </endpoint>
        </send>
        <drop/>
    </filter>
    <send/>
</definitions>

Do you have any specific requirement that permits you to send the HTTP
Content-Type header, if not this should work......

Thanks,
Ruwan

On Sun, May 4, 2008 at 8:38 AM, Garth Patil <ga...@gmail.com> wrote:

> Hi Ruwan,
> Thanks again for all your help. I built from the trunk and re-ran my
> configuration and the sample #50 configuration with the change you
> suggested. Initially, sample #50 succeeds, and my configuration fails.
> In addition to using sample #50 with the axis2Client ant task to post
> the XML and the axis2Server as the service, I also tried a different
> client and server implementations and configurations. For example, I
> created a mock server in php on apache that returns the stock quote
> xml, and i used curl to send the XML (removing the soap-centric
> "SOAPAction: urn:getQuote" header). I tried several different
> permutations, and the ultimate result is that nothing really works
> reliably except the implementations shipped with synapse. The most
> common exceptions I see are:
> 1) org.apache.axis2.AxisFault: Cannot create DocumentElement without
> destination EPR
> 2) ClientWorker Fault creating response SOAP envelope
> org.apache.axis2.AxisFault
> Caused by: java.nio.channels.ClosedChannelException
>
> If you want to try supplementing different implementations for the
> ones shipped with synapse, you can try the ones I used:
> For the stock quote service:
> http://tunnel19.com/synapseStockQuote.php
> For the client:
> curl -d "<m0:getQuote
> xmlns:m0=\"http://services.samples/xsd\ <http://services.samples/xsd%5C>
> "><m0:request><m0:symbol>IBM</m0:symbol></m0:request></m0:getQuote>"
> http://localhost:8080/soap/StockQuote
>
> In any case, I'll wait until the release comes out and test again.
> Best,
> Garth
>
>
> On Fri, May 2, 2008 at 11:25 PM, Ruwan Linton <ru...@gmail.com>
> wrote:
> > Garth,
> >
> >  OK, I got the point. I think POX support in synapse-1.1.1 release was
> not
> >  that solid. But now all it is fixed and if you could build synapse from
> the
> >  trunk, you will be able to get this working without any issue. We are
> >  planing to do a release in the middle of this month, so if you can wait
> for
> >  this release, or build synapse from the svn trunk this is already
> fixed.
> >  Unfortunately we do not have a nightly build setup yet. So if you have
> any
> >  trouble in building synapse, I would like to make a build available to
> you
> >  to test this?
> >
> >  What do you prefer?
> >
> >  PS: You don't have to use the format="POX" in the latest build, if the
> >  request from the client is POX and also you want to send POX to the
> actual
> >  service and all the response will be identified by synapse as POX
> messages
> >  and forwarded back to the client as POX.
> >
> >  Thanks,
> >  Ruwan
> >
> >
> >
> >  On Sat, May 3, 2008 at 7:24 AM, Garth Patil <ga...@gmail.com>
> wrote:
> >
> >  > Hi Ruwan,
> >  > I'm using synapse-1.1.1. If I remove the format="pox" from my
> original
> >  > configuration, or use your filter configuration (both attached), I
> get
> >  > a new series of errors. Synapse now wraps the request to the remote
> >  > server in a soap envelope, instead of leaving it unadulterated. The
> >  > request gets turned from this:
> >  >
> >  > <?xml version="1.0" ?>
> >  > <request>
> >  >  <message>
> >  >   <recipient>abc1234</recipient>
> >  >   <text>Test message.</text>
> >  >  </message>
> >  > </request>
> >  >
> >  > into this:
> >  >
> >  > <?xml version='1.0' encoding='utf-8'?>
> >  > <soapenv:Envelope xmlns:soapenv="
> http://schemas.xmlsoap.org/soap/envelope/
> >  > ">
> >  >  <soapenv:Body>
> >  >     <request>
> >  >      <message>
> >  >        <recipient>abc1234</recipient>
> >  >        <text>Test message.</text>
> >  >      </message>
> >  >    </request>
> >  >   </soapenv:Body>
> >  > </soapenv:Envelope>
> >  >
> >  > Then, because the remote server cannot understand the xml, it
> produces
> >  > a validation error that looks like this:
> >  >
> >  > <?xml version="1.0" ?>
> >  > <response>
> >  >   <status>4</status>
> >  > </response>
> >  >
> >  > Synapse is unhappy with that response and throws the following
> >  > exception in the debug logs, probably because it is expecting some
> >  > kind of SOAP response:
> >  >
> >  > 2008-05-02 18:39:02,985 [172.22.1.144-garth.corp.4info.net]
> >  > [HttpClientWorker-3] ERROR ClientWorker Unexpected response received
> >  > org.apache.axiom.soap.SOAPProcessingException: First Element must
> >  > contain the local name, Envelope , but found response
> >  >        at
> >  >
> org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:219)
> >  >        at
> >  >
> org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(StAXSOAPModelBuilder.java:177)
> >  >        at
> >  >
> org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:163)
> >  >        at
> >  >
> org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:161)
> >  >        at
> >  >
> org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:110)
> >  >        at
> >  >
> org.apache.axis2.builder.SOAPBuilder.processDocument(SOAPBuilder.java:53)
> >  >        at
> >  >
> org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:160)
> >  >        at
> >  >
> org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:111)
> >  >        at
> >  >
> org.apache.synapse.transport.nhttp.ClientWorker.run(ClientWorker.java:160)
> >  >        at
> >  >
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
> >  >        at
> >  >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
> >  >        at java.lang.Thread.run(Thread.java:595)
> >  >
> >  > Synapse then responds to the client with a SOAP fault:
> >  >
> >  > <?xml version='1.0' encoding='utf-8'?>
> >  > <soapenv:Envelope xmlns:soapenv="
> http://schemas.xmlsoap.org/soap/envelope/
> >  > ">
> >  >  <soapenv:Body>
> >  >    <soapenv:Fault>
> >  >      <faultcode>200</faultcode>
> >  >      <faultstring>OK</faultstring>
> >  >      <detail>Unexpected response received : First Element must
> >  > contain the local name, Envelope , but found response</detail>
> >  >    </soapenv:Fault>
> >  >  </soapenv:Body>
> >  > </soapenv:Envelope>
> >  >
> >  > Thanks,
> >  > Garth
> >  >
> >  > On Fri, May 2, 2008 at 6:27 PM, Ruwan Linton <ru...@gmail.com>
> >  > wrote:
> >  > > Hi Garth,
> >  > >
> >  > >  I just checked this with our sample client and it seems to work
> fine. I
> >  > sent
> >  > >  a XML payload to the proxy on Synapse and forwarded that message
> to the
> >  > >  sample service (SimpleStockQuoteService) and send back the
> response.
> >  > (You
> >  > >  don't need to use the format="pox" in the endpoint because you are
> >  > sending a
> >  > >  POX payload) You may verify this by running the sample 50 [1]
> after
> >  > changing
> >  > >  the address endpoint to remove the format="soap11".
> >  > >
> >  > >
> >  > >  <definitions xmlns="http://ws.apache.org/ns/synapse">
> >  > >     <!-- filtering of messages with XPath and regex matches -->
> >  > >     <filter source="get-property('To')" regex=".*/StockQuote.*">
> >  > >         <send>
> >  > >             <endpoint>
> >  > >                 <address
> >  > >  uri="http://localhost:9000/soap/SimpleStockQuoteService"/>
> >  > >             </endpoint>
> >  > >         </send>
> >  > >         <drop/>
> >  > >     </filter>
> >  > >     <send/>
> >  > >  </definitions>
> >  > >
> >  > >
> >  > >  BTW: what is the version of synapse that you are using?
> >  > >
> >  > >  [1] - http://synapse.apache.org/Synapse_Samples.html#Sample50
> >  > >
> >  > >  Thanks,
> >  > >  Ruwan
> >  > >
> >  > >
> >  > >
> >  > >  On Fri, May 2, 2008 at 11:23 PM, Garth Patil <garthpatil@gmail.com
> >
> >  > wrote:
> >  > >
> >  > >  > log4j.category.org.apache.synapse=DEBUG
> >  > >  > log attached.
> >  > >  > Thanks,
> >  > >  > Garth
> >  > >  >
> >  > >  > On Fri, May 2, 2008 at 10:37 AM, Ruwan Linton <
> ruwan.linton@gmail.com
> >  > >
> >  > >  > wrote:
> >  > >  > > Hi Garth,
> >  > >  > >
> >  > >  > >  Thanks for the information, could you please send us the
> synapse
> >  > DEBUG
> >  > >  > log
> >  > >  > >  as well. You can change the log level by editing the
> >  > >  > lib/log4j.properties
> >  > >  > >  file to enable DEBUG logs.
> >  > >  > >
> >  > >  > >  Thanks,
> >  > >  > >  Ruwan
> >  > >  > >
> >  > >  > >
> >  > >  > >
> >  > >  > >  On Fri, May 2, 2008 at 10:56 PM, Garth Patil <
> garthpatil@gmail.com
> >  > >
> >  > >  > wrote:
> >  > >  > >
> >  > >  > >  > The request and response from the actual service is not
> SOAP. It
> >  > is
> >  > >  > >  > just XML. While I understand that synapse is very
> SOAP-centric,
> >  > in
> >  > >  > >  > this case, I want to use synapse to proxy the request for
> >  > logging.
> >  > >  > >  > The request to synapse looks like this:
> >  > >  > >  >
> >  > >  > >  > <?xml version="1.0" ?>
> >  > >  > >  > <request>
> >  > >  > >  >  <message>
> >  > >  > >  >    <recipient>abc1234</recipient>
> >  > >  > >  >    <text>Test message.</text>
> >  > >  > >  >  </message>
> >  > >  > >  > </request>
> >  > >  > >  >
> >  > >  > >  > Synapse passes the request on to the actual service without
> >  > changing
> >  > >  > >  > the XML. The request to the actual service looks exactly
> the
> >  > same
> >  > >  > >  > The response from the actual service looks like this:
> >  > >  > >  >
> >  > >  > >  > <?xml version="1.0" ?>
> >  > >  > >  > <response>
> >  > >  > >  >
>  <requestId>F81D4FAE-7DEC-11D0-A765-00A0C91E6BF6</requestId>
> >  > >  > >  >  <status>1status>
> >  > >  > >  > </response>
> >  > >  > >  >
> >  > >  > >  > But the response returned by synapse adds the soapenv:Body
> and
> >  > >  > >  > soapenv:Envelope tags to the response:
> >  > >  > >  >
> >  > >  > >  > <?xml version="1.0" ?>
> >  > >  > >  > <soapenv:Envelope>
> >  > >  > >  >  <soapenv:Body>
> >  > >  > >  >    <response>
> >  > >  > >  >
>  <requestId>F81D4FAE-7DEC-11D0-A765-00A0C91E6BF6</requestId>
> >  > >  > >  >      <status>1status>
> >  > >  > >  >    </response>
> >  > >  > >  >  </soapenv:Body>
> >  > >  > >  > </soapenv:Envelope>
> >  > >  > >  >
> >  > >  > >  > Thanks to everyone for the help.
> >  > >  > >  > Best,
> >  > >  > >  > Garth
> >  > >  > >  >
> >  > >  > >  > On Thu, May 1, 2008 at 10:11 PM, Asankha C. Perera <
> >  > asankha@wso2.com>
> >  > >  > >  > wrote:
> >  > >  > >  > > Garth
> >  > >  > >  > >
> >  > >  > >  > >  Could you post a sample request sent to Synapse? I think
> the
> >  > >  > problem
> >  > >  > >  > here
> >  > >  > >  > > is that Synapse "detects" your original request as SOAP.
> >  > Probably
> >  > >  > this
> >  > >  > >  > is
> >  > >  > >  > > due to the content type of the message. Is there a
> possibility
> >  > for
> >  > >  > you
> >  > >  > >  > to
> >  > >  > >  > > use the TCPMon to capture an input message and post it
> here?
> >  > >  > >  > >
> >  > >  > >  > >  asankha
> >  > >  > >  > >
> >  > >  > >  > >
> >  > >  > >  > >
> >  > >  > >  > >
> >  > >  > >  > >  Ruwan Linton wrote:
> >  > >  > >  > >
> >  > >  > >  > > > Hi Garth,
> >  > >  > >  > > >
> >  > >  > >  > > > Is it the actual web service which returns SOAP as the
> >  > response
> >  > >  > for
> >  > >  > >  > POX
> >  > >  > >  > > > (XML/HTTP) request, or Synapse. If it is the former you
> need
> >  > to
> >  > >  > ask
> >  > >  > >  > this
> >  > >  > >  > > > question from the web service container guys...
> >  > >  > >  > > >
> >  > >  > >  > > > If the request you send to synapse is POX then synapse
> will
> >  > >  > respond to
> >  > >  > >  > you
> >  > >  > >  > > > as POX regardless of whether it receives a SOAP or
> POX..
> >  > >  > >  > > >
> >  > >  > >  > > > Could you please clarify the problem a little bit more?
> >  > >  > >  > > >
> >  > >  > >  > > > Thanks,
> >  > >  > >  > > > Ruwan
> >  > >  > >  > > >
> >  > >  > >  > > > On Fri, May 2, 2008 at 3:04 AM, Garth Patil <
> >  > garthpatil@gmail.com
> >  > >  > >
> >  > >  > >  > wrote:
> >  > >  > >  > > >
> >  > >  > >  > > >
> >  > >  > >  > > >
> >  > >  > >  > > > > Hi All,
> >  > >  > >  > > > > I'm using synapse to proxy a web service that uses
> XML
> >  > over
> >  > >  > HTTP. My
> >  > >  > >  > > > > configuration looks like this:
> >  > >  > >  > > > > <definitions xmlns= "http://ws.apache.org/ns/synapse
> ">
> >  > >  > >  > > > >  <proxy name="TestProxy">
> >  > >  > >  > > > >   <target>
> >  > >  > >  > > > >     <endpoint>
> >  > >  > >  > > > >       <address uri="http://someremoteservice.com/msg"
> >  > >  > format="pox"
> >  > >  > >  > />
> >  > >  > >  > > > >     </endpoint>
> >  > >  > >  > > > >     <inSequence>
> >  > >  > >  > > > >       <log level= "full" />
> >  > >  > >  > > > >     </inSequence>
> >  > >  > >  > > > >     <outSequence>
> >  > >  > >  > > > >       <log level= "full" />
> >  > >  > >  > > > >       <send />
> >  > >  > >  > > > >     </outSequence>
> >  > >  > >  > > > >   </target>
> >  > >  > >  > > > >  </proxy>
> >  > >  > >  > > > > </definitions>
> >  > >  > >  > > > >
> >  > >  > >  > > > > I post XML to localhost:8080/soap/TestProxy, and
> synapse
> >  > passes
> >  > >  > it
> >  > >  > >  > to
> >  > >  > >  > > > > the specified endpoint without changing it. The
> remote
> >  > service
> >  > >  > >  > returns
> >  > >  > >  > > > > XML which is wrapped in soapenv:Body and
> soapenv:Envelope
> >  > tags.
> >  > >  > Is
> >  > >  > >  > > > > there a way to specify that the response (like the
> >  > request)
> >  > >  > remain
> >  > >  > >  > > > > unadulterated by SOAP tags?
> >  > >  > >  > > > > Thanks,
> >  > >  > >  > > > > Garth
> >  > >  > >  > > > >
> >  > >  > >  > > > >
> >  > >  > >  > > > >
> >  > >  > >  > > >
> >  > >  > >  > > >
> >  > >  > >  > > >
> >  > >  > >  > > >
> >  > >  > >  > > >
> >  > >  > >  > >
> >  > >  > >  >
> >  > >  > >
> >  > >  > >
> >  > >  > >
> >  > >  > >
> >  > >  > >
> >  > >  > > --
> >  > >  > >  Ruwan Linton
> >  > >  > >  http://www.wso2.org - "Oxygenating the Web Services Platform"
> >  > >  > >
> >  > >  >
> >  > >
> >  > >
> >  > >
> >  > >  --
> >  > >
> >  > >
> >  > > Ruwan Linton
> >  > >  http://www.wso2.org - "Oxygenating the Web Services Platform"
> >  > >
> >  >
> >
> >
> >
> >  --
> >
> >
> > Ruwan Linton
> >  http://www.wso2.org - "Oxygenating the Web Services Platform"
> >
>



-- 
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"

Re: Eliminating soap envelope from XML

Posted by Garth Patil <ga...@gmail.com>.
Hi Ruwan,
Thanks again for all your help. I built from the trunk and re-ran my
configuration and the sample #50 configuration with the change you
suggested. Initially, sample #50 succeeds, and my configuration fails.
In addition to using sample #50 with the axis2Client ant task to post
the XML and the axis2Server as the service, I also tried a different
client and server implementations and configurations. For example, I
created a mock server in php on apache that returns the stock quote
xml, and i used curl to send the XML (removing the soap-centric
"SOAPAction: urn:getQuote" header). I tried several different
permutations, and the ultimate result is that nothing really works
reliably except the implementations shipped with synapse. The most
common exceptions I see are:
1) org.apache.axis2.AxisFault: Cannot create DocumentElement without
destination EPR
2) ClientWorker Fault creating response SOAP envelope org.apache.axis2.AxisFault
Caused by: java.nio.channels.ClosedChannelException

If you want to try supplementing different implementations for the
ones shipped with synapse, you can try the ones I used:
For the stock quote service:
http://tunnel19.com/synapseStockQuote.php
For the client:
curl -d "<m0:getQuote
xmlns:m0=\"http://services.samples/xsd\"><m0:request><m0:symbol>IBM</m0:symbol></m0:request></m0:getQuote>"
http://localhost:8080/soap/StockQuote

In any case, I'll wait until the release comes out and test again.
Best,
Garth


On Fri, May 2, 2008 at 11:25 PM, Ruwan Linton <ru...@gmail.com> wrote:
> Garth,
>
>  OK, I got the point. I think POX support in synapse-1.1.1 release was not
>  that solid. But now all it is fixed and if you could build synapse from the
>  trunk, you will be able to get this working without any issue. We are
>  planing to do a release in the middle of this month, so if you can wait for
>  this release, or build synapse from the svn trunk this is already fixed.
>  Unfortunately we do not have a nightly build setup yet. So if you have any
>  trouble in building synapse, I would like to make a build available to you
>  to test this?
>
>  What do you prefer?
>
>  PS: You don't have to use the format="POX" in the latest build, if the
>  request from the client is POX and also you want to send POX to the actual
>  service and all the response will be identified by synapse as POX messages
>  and forwarded back to the client as POX.
>
>  Thanks,
>  Ruwan
>
>
>
>  On Sat, May 3, 2008 at 7:24 AM, Garth Patil <ga...@gmail.com> wrote:
>
>  > Hi Ruwan,
>  > I'm using synapse-1.1.1. If I remove the format="pox" from my original
>  > configuration, or use your filter configuration (both attached), I get
>  > a new series of errors. Synapse now wraps the request to the remote
>  > server in a soap envelope, instead of leaving it unadulterated. The
>  > request gets turned from this:
>  >
>  > <?xml version="1.0" ?>
>  > <request>
>  >  <message>
>  >   <recipient>abc1234</recipient>
>  >   <text>Test message.</text>
>  >  </message>
>  > </request>
>  >
>  > into this:
>  >
>  > <?xml version='1.0' encoding='utf-8'?>
>  > <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
>  > ">
>  >  <soapenv:Body>
>  >     <request>
>  >      <message>
>  >        <recipient>abc1234</recipient>
>  >        <text>Test message.</text>
>  >      </message>
>  >    </request>
>  >   </soapenv:Body>
>  > </soapenv:Envelope>
>  >
>  > Then, because the remote server cannot understand the xml, it produces
>  > a validation error that looks like this:
>  >
>  > <?xml version="1.0" ?>
>  > <response>
>  >   <status>4</status>
>  > </response>
>  >
>  > Synapse is unhappy with that response and throws the following
>  > exception in the debug logs, probably because it is expecting some
>  > kind of SOAP response:
>  >
>  > 2008-05-02 18:39:02,985 [172.22.1.144-garth.corp.4info.net]
>  > [HttpClientWorker-3] ERROR ClientWorker Unexpected response received
>  > org.apache.axiom.soap.SOAPProcessingException: First Element must
>  > contain the local name, Envelope , but found response
>  >        at
>  > org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:219)
>  >        at
>  > org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(StAXSOAPModelBuilder.java:177)
>  >        at
>  > org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:163)
>  >        at
>  > org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:161)
>  >        at
>  > org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:110)
>  >        at
>  > org.apache.axis2.builder.SOAPBuilder.processDocument(SOAPBuilder.java:53)
>  >        at
>  > org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:160)
>  >        at
>  > org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:111)
>  >        at
>  > org.apache.synapse.transport.nhttp.ClientWorker.run(ClientWorker.java:160)
>  >        at
>  > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>  >        at
>  > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>  >        at java.lang.Thread.run(Thread.java:595)
>  >
>  > Synapse then responds to the client with a SOAP fault:
>  >
>  > <?xml version='1.0' encoding='utf-8'?>
>  > <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
>  > ">
>  >  <soapenv:Body>
>  >    <soapenv:Fault>
>  >      <faultcode>200</faultcode>
>  >      <faultstring>OK</faultstring>
>  >      <detail>Unexpected response received : First Element must
>  > contain the local name, Envelope , but found response</detail>
>  >    </soapenv:Fault>
>  >  </soapenv:Body>
>  > </soapenv:Envelope>
>  >
>  > Thanks,
>  > Garth
>  >
>  > On Fri, May 2, 2008 at 6:27 PM, Ruwan Linton <ru...@gmail.com>
>  > wrote:
>  > > Hi Garth,
>  > >
>  > >  I just checked this with our sample client and it seems to work fine. I
>  > sent
>  > >  a XML payload to the proxy on Synapse and forwarded that message to the
>  > >  sample service (SimpleStockQuoteService) and send back the response.
>  > (You
>  > >  don't need to use the format="pox" in the endpoint because you are
>  > sending a
>  > >  POX payload) You may verify this by running the sample 50 [1] after
>  > changing
>  > >  the address endpoint to remove the format="soap11".
>  > >
>  > >
>  > >  <definitions xmlns="http://ws.apache.org/ns/synapse">
>  > >     <!-- filtering of messages with XPath and regex matches -->
>  > >     <filter source="get-property('To')" regex=".*/StockQuote.*">
>  > >         <send>
>  > >             <endpoint>
>  > >                 <address
>  > >  uri="http://localhost:9000/soap/SimpleStockQuoteService"/>
>  > >             </endpoint>
>  > >         </send>
>  > >         <drop/>
>  > >     </filter>
>  > >     <send/>
>  > >  </definitions>
>  > >
>  > >
>  > >  BTW: what is the version of synapse that you are using?
>  > >
>  > >  [1] - http://synapse.apache.org/Synapse_Samples.html#Sample50
>  > >
>  > >  Thanks,
>  > >  Ruwan
>  > >
>  > >
>  > >
>  > >  On Fri, May 2, 2008 at 11:23 PM, Garth Patil <ga...@gmail.com>
>  > wrote:
>  > >
>  > >  > log4j.category.org.apache.synapse=DEBUG
>  > >  > log attached.
>  > >  > Thanks,
>  > >  > Garth
>  > >  >
>  > >  > On Fri, May 2, 2008 at 10:37 AM, Ruwan Linton <ruwan.linton@gmail.com
>  > >
>  > >  > wrote:
>  > >  > > Hi Garth,
>  > >  > >
>  > >  > >  Thanks for the information, could you please send us the synapse
>  > DEBUG
>  > >  > log
>  > >  > >  as well. You can change the log level by editing the
>  > >  > lib/log4j.properties
>  > >  > >  file to enable DEBUG logs.
>  > >  > >
>  > >  > >  Thanks,
>  > >  > >  Ruwan
>  > >  > >
>  > >  > >
>  > >  > >
>  > >  > >  On Fri, May 2, 2008 at 10:56 PM, Garth Patil <garthpatil@gmail.com
>  > >
>  > >  > wrote:
>  > >  > >
>  > >  > >  > The request and response from the actual service is not SOAP. It
>  > is
>  > >  > >  > just XML. While I understand that synapse is very SOAP-centric,
>  > in
>  > >  > >  > this case, I want to use synapse to proxy the request for
>  > logging.
>  > >  > >  > The request to synapse looks like this:
>  > >  > >  >
>  > >  > >  > <?xml version="1.0" ?>
>  > >  > >  > <request>
>  > >  > >  >  <message>
>  > >  > >  >    <recipient>abc1234</recipient>
>  > >  > >  >    <text>Test message.</text>
>  > >  > >  >  </message>
>  > >  > >  > </request>
>  > >  > >  >
>  > >  > >  > Synapse passes the request on to the actual service without
>  > changing
>  > >  > >  > the XML. The request to the actual service looks exactly the
>  > same
>  > >  > >  > The response from the actual service looks like this:
>  > >  > >  >
>  > >  > >  > <?xml version="1.0" ?>
>  > >  > >  > <response>
>  > >  > >  >  <requestId>F81D4FAE-7DEC-11D0-A765-00A0C91E6BF6</requestId>
>  > >  > >  >  <status>1status>
>  > >  > >  > </response>
>  > >  > >  >
>  > >  > >  > But the response returned by synapse adds the soapenv:Body and
>  > >  > >  > soapenv:Envelope tags to the response:
>  > >  > >  >
>  > >  > >  > <?xml version="1.0" ?>
>  > >  > >  > <soapenv:Envelope>
>  > >  > >  >  <soapenv:Body>
>  > >  > >  >    <response>
>  > >  > >  >      <requestId>F81D4FAE-7DEC-11D0-A765-00A0C91E6BF6</requestId>
>  > >  > >  >      <status>1status>
>  > >  > >  >    </response>
>  > >  > >  >  </soapenv:Body>
>  > >  > >  > </soapenv:Envelope>
>  > >  > >  >
>  > >  > >  > Thanks to everyone for the help.
>  > >  > >  > Best,
>  > >  > >  > Garth
>  > >  > >  >
>  > >  > >  > On Thu, May 1, 2008 at 10:11 PM, Asankha C. Perera <
>  > asankha@wso2.com>
>  > >  > >  > wrote:
>  > >  > >  > > Garth
>  > >  > >  > >
>  > >  > >  > >  Could you post a sample request sent to Synapse? I think the
>  > >  > problem
>  > >  > >  > here
>  > >  > >  > > is that Synapse "detects" your original request as SOAP.
>  > Probably
>  > >  > this
>  > >  > >  > is
>  > >  > >  > > due to the content type of the message. Is there a possibility
>  > for
>  > >  > you
>  > >  > >  > to
>  > >  > >  > > use the TCPMon to capture an input message and post it here?
>  > >  > >  > >
>  > >  > >  > >  asankha
>  > >  > >  > >
>  > >  > >  > >
>  > >  > >  > >
>  > >  > >  > >
>  > >  > >  > >  Ruwan Linton wrote:
>  > >  > >  > >
>  > >  > >  > > > Hi Garth,
>  > >  > >  > > >
>  > >  > >  > > > Is it the actual web service which returns SOAP as the
>  > response
>  > >  > for
>  > >  > >  > POX
>  > >  > >  > > > (XML/HTTP) request, or Synapse. If it is the former you need
>  > to
>  > >  > ask
>  > >  > >  > this
>  > >  > >  > > > question from the web service container guys...
>  > >  > >  > > >
>  > >  > >  > > > If the request you send to synapse is POX then synapse will
>  > >  > respond to
>  > >  > >  > you
>  > >  > >  > > > as POX regardless of whether it receives a SOAP or POX..
>  > >  > >  > > >
>  > >  > >  > > > Could you please clarify the problem a little bit more?
>  > >  > >  > > >
>  > >  > >  > > > Thanks,
>  > >  > >  > > > Ruwan
>  > >  > >  > > >
>  > >  > >  > > > On Fri, May 2, 2008 at 3:04 AM, Garth Patil <
>  > garthpatil@gmail.com
>  > >  > >
>  > >  > >  > wrote:
>  > >  > >  > > >
>  > >  > >  > > >
>  > >  > >  > > >
>  > >  > >  > > > > Hi All,
>  > >  > >  > > > > I'm using synapse to proxy a web service that uses XML
>  > over
>  > >  > HTTP. My
>  > >  > >  > > > > configuration looks like this:
>  > >  > >  > > > > <definitions xmlns= "http://ws.apache.org/ns/synapse">
>  > >  > >  > > > >  <proxy name="TestProxy">
>  > >  > >  > > > >   <target>
>  > >  > >  > > > >     <endpoint>
>  > >  > >  > > > >       <address uri="http://someremoteservice.com/msg"
>  > >  > format="pox"
>  > >  > >  > />
>  > >  > >  > > > >     </endpoint>
>  > >  > >  > > > >     <inSequence>
>  > >  > >  > > > >       <log level= "full" />
>  > >  > >  > > > >     </inSequence>
>  > >  > >  > > > >     <outSequence>
>  > >  > >  > > > >       <log level= "full" />
>  > >  > >  > > > >       <send />
>  > >  > >  > > > >     </outSequence>
>  > >  > >  > > > >   </target>
>  > >  > >  > > > >  </proxy>
>  > >  > >  > > > > </definitions>
>  > >  > >  > > > >
>  > >  > >  > > > > I post XML to localhost:8080/soap/TestProxy, and synapse
>  > passes
>  > >  > it
>  > >  > >  > to
>  > >  > >  > > > > the specified endpoint without changing it. The remote
>  > service
>  > >  > >  > returns
>  > >  > >  > > > > XML which is wrapped in soapenv:Body and soapenv:Envelope
>  > tags.
>  > >  > Is
>  > >  > >  > > > > there a way to specify that the response (like the
>  > request)
>  > >  > remain
>  > >  > >  > > > > unadulterated by SOAP tags?
>  > >  > >  > > > > Thanks,
>  > >  > >  > > > > Garth
>  > >  > >  > > > >
>  > >  > >  > > > >
>  > >  > >  > > > >
>  > >  > >  > > >
>  > >  > >  > > >
>  > >  > >  > > >
>  > >  > >  > > >
>  > >  > >  > > >
>  > >  > >  > >
>  > >  > >  >
>  > >  > >
>  > >  > >
>  > >  > >
>  > >  > >
>  > >  > >
>  > >  > > --
>  > >  > >  Ruwan Linton
>  > >  > >  http://www.wso2.org - "Oxygenating the Web Services Platform"
>  > >  > >
>  > >  >
>  > >
>  > >
>  > >
>  > >  --
>  > >
>  > >
>  > > Ruwan Linton
>  > >  http://www.wso2.org - "Oxygenating the Web Services Platform"
>  > >
>  >
>
>
>
>  --
>
>
> Ruwan Linton
>  http://www.wso2.org - "Oxygenating the Web Services Platform"
>

Re: Eliminating soap envelope from XML

Posted by Ruwan Linton <ru...@gmail.com>.
Garth,

OK, I got the point. I think POX support in synapse-1.1.1 release was not
that solid. But now all it is fixed and if you could build synapse from the
trunk, you will be able to get this working without any issue. We are
planing to do a release in the middle of this month, so if you can wait for
this release, or build synapse from the svn trunk this is already fixed.
Unfortunately we do not have a nightly build setup yet. So if you have any
trouble in building synapse, I would like to make a build available to you
to test this?

What do you prefer?

PS: You don't have to use the format="POX" in the latest build, if the
request from the client is POX and also you want to send POX to the actual
service and all the response will be identified by synapse as POX messages
and forwarded back to the client as POX.

Thanks,
Ruwan

On Sat, May 3, 2008 at 7:24 AM, Garth Patil <ga...@gmail.com> wrote:

> Hi Ruwan,
> I'm using synapse-1.1.1. If I remove the format="pox" from my original
> configuration, or use your filter configuration (both attached), I get
> a new series of errors. Synapse now wraps the request to the remote
> server in a soap envelope, instead of leaving it unadulterated. The
> request gets turned from this:
>
> <?xml version="1.0" ?>
> <request>
>  <message>
>   <recipient>abc1234</recipient>
>   <text>Test message.</text>
>  </message>
> </request>
>
> into this:
>
> <?xml version='1.0' encoding='utf-8'?>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
> ">
>  <soapenv:Body>
>     <request>
>      <message>
>        <recipient>abc1234</recipient>
>        <text>Test message.</text>
>      </message>
>    </request>
>   </soapenv:Body>
> </soapenv:Envelope>
>
> Then, because the remote server cannot understand the xml, it produces
> a validation error that looks like this:
>
> <?xml version="1.0" ?>
> <response>
>   <status>4</status>
> </response>
>
> Synapse is unhappy with that response and throws the following
> exception in the debug logs, probably because it is expecting some
> kind of SOAP response:
>
> 2008-05-02 18:39:02,985 [172.22.1.144-garth.corp.4info.net]
> [HttpClientWorker-3] ERROR ClientWorker Unexpected response received
> org.apache.axiom.soap.SOAPProcessingException: First Element must
> contain the local name, Envelope , but found response
>        at
> org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:219)
>        at
> org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(StAXSOAPModelBuilder.java:177)
>        at
> org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:163)
>        at
> org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:161)
>        at
> org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:110)
>        at
> org.apache.axis2.builder.SOAPBuilder.processDocument(SOAPBuilder.java:53)
>        at
> org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:160)
>        at
> org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:111)
>        at
> org.apache.synapse.transport.nhttp.ClientWorker.run(ClientWorker.java:160)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>        at java.lang.Thread.run(Thread.java:595)
>
> Synapse then responds to the client with a SOAP fault:
>
> <?xml version='1.0' encoding='utf-8'?>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
> ">
>  <soapenv:Body>
>    <soapenv:Fault>
>      <faultcode>200</faultcode>
>      <faultstring>OK</faultstring>
>      <detail>Unexpected response received : First Element must
> contain the local name, Envelope , but found response</detail>
>    </soapenv:Fault>
>  </soapenv:Body>
> </soapenv:Envelope>
>
> Thanks,
> Garth
>
> On Fri, May 2, 2008 at 6:27 PM, Ruwan Linton <ru...@gmail.com>
> wrote:
> > Hi Garth,
> >
> >  I just checked this with our sample client and it seems to work fine. I
> sent
> >  a XML payload to the proxy on Synapse and forwarded that message to the
> >  sample service (SimpleStockQuoteService) and send back the response.
> (You
> >  don't need to use the format="pox" in the endpoint because you are
> sending a
> >  POX payload) You may verify this by running the sample 50 [1] after
> changing
> >  the address endpoint to remove the format="soap11".
> >
> >
> >  <definitions xmlns="http://ws.apache.org/ns/synapse">
> >     <!-- filtering of messages with XPath and regex matches -->
> >     <filter source="get-property('To')" regex=".*/StockQuote.*">
> >         <send>
> >             <endpoint>
> >                 <address
> >  uri="http://localhost:9000/soap/SimpleStockQuoteService"/>
> >             </endpoint>
> >         </send>
> >         <drop/>
> >     </filter>
> >     <send/>
> >  </definitions>
> >
> >
> >  BTW: what is the version of synapse that you are using?
> >
> >  [1] - http://synapse.apache.org/Synapse_Samples.html#Sample50
> >
> >  Thanks,
> >  Ruwan
> >
> >
> >
> >  On Fri, May 2, 2008 at 11:23 PM, Garth Patil <ga...@gmail.com>
> wrote:
> >
> >  > log4j.category.org.apache.synapse=DEBUG
> >  > log attached.
> >  > Thanks,
> >  > Garth
> >  >
> >  > On Fri, May 2, 2008 at 10:37 AM, Ruwan Linton <ruwan.linton@gmail.com
> >
> >  > wrote:
> >  > > Hi Garth,
> >  > >
> >  > >  Thanks for the information, could you please send us the synapse
> DEBUG
> >  > log
> >  > >  as well. You can change the log level by editing the
> >  > lib/log4j.properties
> >  > >  file to enable DEBUG logs.
> >  > >
> >  > >  Thanks,
> >  > >  Ruwan
> >  > >
> >  > >
> >  > >
> >  > >  On Fri, May 2, 2008 at 10:56 PM, Garth Patil <garthpatil@gmail.com
> >
> >  > wrote:
> >  > >
> >  > >  > The request and response from the actual service is not SOAP. It
> is
> >  > >  > just XML. While I understand that synapse is very SOAP-centric,
> in
> >  > >  > this case, I want to use synapse to proxy the request for
> logging.
> >  > >  > The request to synapse looks like this:
> >  > >  >
> >  > >  > <?xml version="1.0" ?>
> >  > >  > <request>
> >  > >  >  <message>
> >  > >  >    <recipient>abc1234</recipient>
> >  > >  >    <text>Test message.</text>
> >  > >  >  </message>
> >  > >  > </request>
> >  > >  >
> >  > >  > Synapse passes the request on to the actual service without
> changing
> >  > >  > the XML. The request to the actual service looks exactly the
> same
> >  > >  > The response from the actual service looks like this:
> >  > >  >
> >  > >  > <?xml version="1.0" ?>
> >  > >  > <response>
> >  > >  >  <requestId>F81D4FAE-7DEC-11D0-A765-00A0C91E6BF6</requestId>
> >  > >  >  <status>1status>
> >  > >  > </response>
> >  > >  >
> >  > >  > But the response returned by synapse adds the soapenv:Body and
> >  > >  > soapenv:Envelope tags to the response:
> >  > >  >
> >  > >  > <?xml version="1.0" ?>
> >  > >  > <soapenv:Envelope>
> >  > >  >  <soapenv:Body>
> >  > >  >    <response>
> >  > >  >      <requestId>F81D4FAE-7DEC-11D0-A765-00A0C91E6BF6</requestId>
> >  > >  >      <status>1status>
> >  > >  >    </response>
> >  > >  >  </soapenv:Body>
> >  > >  > </soapenv:Envelope>
> >  > >  >
> >  > >  > Thanks to everyone for the help.
> >  > >  > Best,
> >  > >  > Garth
> >  > >  >
> >  > >  > On Thu, May 1, 2008 at 10:11 PM, Asankha C. Perera <
> asankha@wso2.com>
> >  > >  > wrote:
> >  > >  > > Garth
> >  > >  > >
> >  > >  > >  Could you post a sample request sent to Synapse? I think the
> >  > problem
> >  > >  > here
> >  > >  > > is that Synapse "detects" your original request as SOAP.
> Probably
> >  > this
> >  > >  > is
> >  > >  > > due to the content type of the message. Is there a possibility
> for
> >  > you
> >  > >  > to
> >  > >  > > use the TCPMon to capture an input message and post it here?
> >  > >  > >
> >  > >  > >  asankha
> >  > >  > >
> >  > >  > >
> >  > >  > >
> >  > >  > >
> >  > >  > >  Ruwan Linton wrote:
> >  > >  > >
> >  > >  > > > Hi Garth,
> >  > >  > > >
> >  > >  > > > Is it the actual web service which returns SOAP as the
> response
> >  > for
> >  > >  > POX
> >  > >  > > > (XML/HTTP) request, or Synapse. If it is the former you need
> to
> >  > ask
> >  > >  > this
> >  > >  > > > question from the web service container guys...
> >  > >  > > >
> >  > >  > > > If the request you send to synapse is POX then synapse will
> >  > respond to
> >  > >  > you
> >  > >  > > > as POX regardless of whether it receives a SOAP or POX..
> >  > >  > > >
> >  > >  > > > Could you please clarify the problem a little bit more?
> >  > >  > > >
> >  > >  > > > Thanks,
> >  > >  > > > Ruwan
> >  > >  > > >
> >  > >  > > > On Fri, May 2, 2008 at 3:04 AM, Garth Patil <
> garthpatil@gmail.com
> >  > >
> >  > >  > wrote:
> >  > >  > > >
> >  > >  > > >
> >  > >  > > >
> >  > >  > > > > Hi All,
> >  > >  > > > > I'm using synapse to proxy a web service that uses XML
> over
> >  > HTTP. My
> >  > >  > > > > configuration looks like this:
> >  > >  > > > > <definitions xmlns= "http://ws.apache.org/ns/synapse">
> >  > >  > > > >  <proxy name="TestProxy">
> >  > >  > > > >   <target>
> >  > >  > > > >     <endpoint>
> >  > >  > > > >       <address uri="http://someremoteservice.com/msg"
> >  > format="pox"
> >  > >  > />
> >  > >  > > > >     </endpoint>
> >  > >  > > > >     <inSequence>
> >  > >  > > > >       <log level= "full" />
> >  > >  > > > >     </inSequence>
> >  > >  > > > >     <outSequence>
> >  > >  > > > >       <log level= "full" />
> >  > >  > > > >       <send />
> >  > >  > > > >     </outSequence>
> >  > >  > > > >   </target>
> >  > >  > > > >  </proxy>
> >  > >  > > > > </definitions>
> >  > >  > > > >
> >  > >  > > > > I post XML to localhost:8080/soap/TestProxy, and synapse
> passes
> >  > it
> >  > >  > to
> >  > >  > > > > the specified endpoint without changing it. The remote
> service
> >  > >  > returns
> >  > >  > > > > XML which is wrapped in soapenv:Body and soapenv:Envelope
> tags.
> >  > Is
> >  > >  > > > > there a way to specify that the response (like the
> request)
> >  > remain
> >  > >  > > > > unadulterated by SOAP tags?
> >  > >  > > > > Thanks,
> >  > >  > > > > Garth
> >  > >  > > > >
> >  > >  > > > >
> >  > >  > > > >
> >  > >  > > >
> >  > >  > > >
> >  > >  > > >
> >  > >  > > >
> >  > >  > > >
> >  > >  > >
> >  > >  >
> >  > >
> >  > >
> >  > >
> >  > >
> >  > >
> >  > > --
> >  > >  Ruwan Linton
> >  > >  http://www.wso2.org - "Oxygenating the Web Services Platform"
> >  > >
> >  >
> >
> >
> >
> >  --
> >
> >
> > Ruwan Linton
> >  http://www.wso2.org - "Oxygenating the Web Services Platform"
> >
>



-- 
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"

Re: Eliminating soap envelope from XML

Posted by Garth Patil <ga...@gmail.com>.
Hi Ruwan,
I'm using synapse-1.1.1. If I remove the format="pox" from my original
configuration, or use your filter configuration (both attached), I get
a new series of errors. Synapse now wraps the request to the remote
server in a soap envelope, instead of leaving it unadulterated. The
request gets turned from this:

<?xml version="1.0" ?>
<request>
 <message>
   <recipient>abc1234</recipient>
   <text>Test message.</text>
 </message>
</request>

into this:

<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Body>
    <request>
      <message>
        <recipient>abc1234</recipient>
        <text>Test message.</text>
      </message>
    </request>
  </soapenv:Body>
</soapenv:Envelope>

Then, because the remote server cannot understand the xml, it produces
a validation error that looks like this:

<?xml version="1.0" ?>
<response>
  <status>4</status>
</response>

Synapse is unhappy with that response and throws the following
exception in the debug logs, probably because it is expecting some
kind of SOAP response:

2008-05-02 18:39:02,985 [172.22.1.144-garth.corp.4info.net]
[HttpClientWorker-3] ERROR ClientWorker Unexpected response received
org.apache.axiom.soap.SOAPProcessingException: First Element must
contain the local name, Envelope , but found response
        at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:219)
        at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(StAXSOAPModelBuilder.java:177)
        at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:163)
        at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:161)
        at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:110)
        at org.apache.axis2.builder.SOAPBuilder.processDocument(SOAPBuilder.java:53)
        at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:160)
        at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:111)
        at org.apache.synapse.transport.nhttp.ClientWorker.run(ClientWorker.java:160)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:595)

Synapse then responds to the client with a SOAP fault:

<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Body>
    <soapenv:Fault>
      <faultcode>200</faultcode>
      <faultstring>OK</faultstring>
      <detail>Unexpected response received : First Element must
contain the local name, Envelope , but found response</detail>
    </soapenv:Fault>
  </soapenv:Body>
</soapenv:Envelope>

Thanks,
Garth

On Fri, May 2, 2008 at 6:27 PM, Ruwan Linton <ru...@gmail.com> wrote:
> Hi Garth,
>
>  I just checked this with our sample client and it seems to work fine. I sent
>  a XML payload to the proxy on Synapse and forwarded that message to the
>  sample service (SimpleStockQuoteService) and send back the response. (You
>  don't need to use the format="pox" in the endpoint because you are sending a
>  POX payload) You may verify this by running the sample 50 [1] after changing
>  the address endpoint to remove the format="soap11".
>
>
>  <definitions xmlns="http://ws.apache.org/ns/synapse">
>     <!-- filtering of messages with XPath and regex matches -->
>     <filter source="get-property('To')" regex=".*/StockQuote.*">
>         <send>
>             <endpoint>
>                 <address
>  uri="http://localhost:9000/soap/SimpleStockQuoteService"/>
>             </endpoint>
>         </send>
>         <drop/>
>     </filter>
>     <send/>
>  </definitions>
>
>
>  BTW: what is the version of synapse that you are using?
>
>  [1] - http://synapse.apache.org/Synapse_Samples.html#Sample50
>
>  Thanks,
>  Ruwan
>
>
>
>  On Fri, May 2, 2008 at 11:23 PM, Garth Patil <ga...@gmail.com> wrote:
>
>  > log4j.category.org.apache.synapse=DEBUG
>  > log attached.
>  > Thanks,
>  > Garth
>  >
>  > On Fri, May 2, 2008 at 10:37 AM, Ruwan Linton <ru...@gmail.com>
>  > wrote:
>  > > Hi Garth,
>  > >
>  > >  Thanks for the information, could you please send us the synapse DEBUG
>  > log
>  > >  as well. You can change the log level by editing the
>  > lib/log4j.properties
>  > >  file to enable DEBUG logs.
>  > >
>  > >  Thanks,
>  > >  Ruwan
>  > >
>  > >
>  > >
>  > >  On Fri, May 2, 2008 at 10:56 PM, Garth Patil <ga...@gmail.com>
>  > wrote:
>  > >
>  > >  > The request and response from the actual service is not SOAP. It is
>  > >  > just XML. While I understand that synapse is very SOAP-centric, in
>  > >  > this case, I want to use synapse to proxy the request for logging.
>  > >  > The request to synapse looks like this:
>  > >  >
>  > >  > <?xml version="1.0" ?>
>  > >  > <request>
>  > >  >  <message>
>  > >  >    <recipient>abc1234</recipient>
>  > >  >    <text>Test message.</text>
>  > >  >  </message>
>  > >  > </request>
>  > >  >
>  > >  > Synapse passes the request on to the actual service without changing
>  > >  > the XML. The request to the actual service looks exactly the same
>  > >  > The response from the actual service looks like this:
>  > >  >
>  > >  > <?xml version="1.0" ?>
>  > >  > <response>
>  > >  >  <requestId>F81D4FAE-7DEC-11D0-A765-00A0C91E6BF6</requestId>
>  > >  >  <status>1status>
>  > >  > </response>
>  > >  >
>  > >  > But the response returned by synapse adds the soapenv:Body and
>  > >  > soapenv:Envelope tags to the response:
>  > >  >
>  > >  > <?xml version="1.0" ?>
>  > >  > <soapenv:Envelope>
>  > >  >  <soapenv:Body>
>  > >  >    <response>
>  > >  >      <requestId>F81D4FAE-7DEC-11D0-A765-00A0C91E6BF6</requestId>
>  > >  >      <status>1status>
>  > >  >    </response>
>  > >  >  </soapenv:Body>
>  > >  > </soapenv:Envelope>
>  > >  >
>  > >  > Thanks to everyone for the help.
>  > >  > Best,
>  > >  > Garth
>  > >  >
>  > >  > On Thu, May 1, 2008 at 10:11 PM, Asankha C. Perera <as...@wso2.com>
>  > >  > wrote:
>  > >  > > Garth
>  > >  > >
>  > >  > >  Could you post a sample request sent to Synapse? I think the
>  > problem
>  > >  > here
>  > >  > > is that Synapse "detects" your original request as SOAP. Probably
>  > this
>  > >  > is
>  > >  > > due to the content type of the message. Is there a possibility for
>  > you
>  > >  > to
>  > >  > > use the TCPMon to capture an input message and post it here?
>  > >  > >
>  > >  > >  asankha
>  > >  > >
>  > >  > >
>  > >  > >
>  > >  > >
>  > >  > >  Ruwan Linton wrote:
>  > >  > >
>  > >  > > > Hi Garth,
>  > >  > > >
>  > >  > > > Is it the actual web service which returns SOAP as the response
>  > for
>  > >  > POX
>  > >  > > > (XML/HTTP) request, or Synapse. If it is the former you need to
>  > ask
>  > >  > this
>  > >  > > > question from the web service container guys...
>  > >  > > >
>  > >  > > > If the request you send to synapse is POX then synapse will
>  > respond to
>  > >  > you
>  > >  > > > as POX regardless of whether it receives a SOAP or POX..
>  > >  > > >
>  > >  > > > Could you please clarify the problem a little bit more?
>  > >  > > >
>  > >  > > > Thanks,
>  > >  > > > Ruwan
>  > >  > > >
>  > >  > > > On Fri, May 2, 2008 at 3:04 AM, Garth Patil <garthpatil@gmail.com
>  > >
>  > >  > wrote:
>  > >  > > >
>  > >  > > >
>  > >  > > >
>  > >  > > > > Hi All,
>  > >  > > > > I'm using synapse to proxy a web service that uses XML over
>  > HTTP. My
>  > >  > > > > configuration looks like this:
>  > >  > > > > <definitions xmlns= "http://ws.apache.org/ns/synapse">
>  > >  > > > >  <proxy name="TestProxy">
>  > >  > > > >   <target>
>  > >  > > > >     <endpoint>
>  > >  > > > >       <address uri="http://someremoteservice.com/msg"
>  > format="pox"
>  > >  > />
>  > >  > > > >     </endpoint>
>  > >  > > > >     <inSequence>
>  > >  > > > >       <log level= "full" />
>  > >  > > > >     </inSequence>
>  > >  > > > >     <outSequence>
>  > >  > > > >       <log level= "full" />
>  > >  > > > >       <send />
>  > >  > > > >     </outSequence>
>  > >  > > > >   </target>
>  > >  > > > >  </proxy>
>  > >  > > > > </definitions>
>  > >  > > > >
>  > >  > > > > I post XML to localhost:8080/soap/TestProxy, and synapse passes
>  > it
>  > >  > to
>  > >  > > > > the specified endpoint without changing it. The remote service
>  > >  > returns
>  > >  > > > > XML which is wrapped in soapenv:Body and soapenv:Envelope tags.
>  > Is
>  > >  > > > > there a way to specify that the response (like the request)
>  > remain
>  > >  > > > > unadulterated by SOAP tags?
>  > >  > > > > Thanks,
>  > >  > > > > Garth
>  > >  > > > >
>  > >  > > > >
>  > >  > > > >
>  > >  > > >
>  > >  > > >
>  > >  > > >
>  > >  > > >
>  > >  > > >
>  > >  > >
>  > >  >
>  > >
>  > >
>  > >
>  > >
>  > >
>  > > --
>  > >  Ruwan Linton
>  > >  http://www.wso2.org - "Oxygenating the Web Services Platform"
>  > >
>  >
>
>
>
>  --
>
>
> Ruwan Linton
>  http://www.wso2.org - "Oxygenating the Web Services Platform"
>

Re: Eliminating soap envelope from XML

Posted by Ruwan Linton <ru...@gmail.com>.
Hi Garth,

I just checked this with our sample client and it seems to work fine. I sent
a XML payload to the proxy on Synapse and forwarded that message to the
sample service (SimpleStockQuoteService) and send back the response. (You
don't need to use the format="pox" in the endpoint because you are sending a
POX payload) You may verify this by running the sample 50 [1] after changing
the address endpoint to remove the format="soap11".

<definitions xmlns="http://ws.apache.org/ns/synapse">
    <!-- filtering of messages with XPath and regex matches -->
    <filter source="get-property('To')" regex=".*/StockQuote.*">
        <send>
            <endpoint>
                <address
uri="http://localhost:9000/soap/SimpleStockQuoteService"/>
            </endpoint>
        </send>
        <drop/>
    </filter>
    <send/>
</definitions>


BTW: what is the version of synapse that you are using?

[1] - http://synapse.apache.org/Synapse_Samples.html#Sample50

Thanks,
Ruwan

On Fri, May 2, 2008 at 11:23 PM, Garth Patil <ga...@gmail.com> wrote:

> log4j.category.org.apache.synapse=DEBUG
> log attached.
> Thanks,
> Garth
>
> On Fri, May 2, 2008 at 10:37 AM, Ruwan Linton <ru...@gmail.com>
> wrote:
> > Hi Garth,
> >
> >  Thanks for the information, could you please send us the synapse DEBUG
> log
> >  as well. You can change the log level by editing the
> lib/log4j.properties
> >  file to enable DEBUG logs.
> >
> >  Thanks,
> >  Ruwan
> >
> >
> >
> >  On Fri, May 2, 2008 at 10:56 PM, Garth Patil <ga...@gmail.com>
> wrote:
> >
> >  > The request and response from the actual service is not SOAP. It is
> >  > just XML. While I understand that synapse is very SOAP-centric, in
> >  > this case, I want to use synapse to proxy the request for logging.
> >  > The request to synapse looks like this:
> >  >
> >  > <?xml version="1.0" ?>
> >  > <request>
> >  >  <message>
> >  >    <recipient>abc1234</recipient>
> >  >    <text>Test message.</text>
> >  >  </message>
> >  > </request>
> >  >
> >  > Synapse passes the request on to the actual service without changing
> >  > the XML. The request to the actual service looks exactly the same
> >  > The response from the actual service looks like this:
> >  >
> >  > <?xml version="1.0" ?>
> >  > <response>
> >  >  <requestId>F81D4FAE-7DEC-11D0-A765-00A0C91E6BF6</requestId>
> >  >  <status>1status>
> >  > </response>
> >  >
> >  > But the response returned by synapse adds the soapenv:Body and
> >  > soapenv:Envelope tags to the response:
> >  >
> >  > <?xml version="1.0" ?>
> >  > <soapenv:Envelope>
> >  >  <soapenv:Body>
> >  >    <response>
> >  >      <requestId>F81D4FAE-7DEC-11D0-A765-00A0C91E6BF6</requestId>
> >  >      <status>1status>
> >  >    </response>
> >  >  </soapenv:Body>
> >  > </soapenv:Envelope>
> >  >
> >  > Thanks to everyone for the help.
> >  > Best,
> >  > Garth
> >  >
> >  > On Thu, May 1, 2008 at 10:11 PM, Asankha C. Perera <as...@wso2.com>
> >  > wrote:
> >  > > Garth
> >  > >
> >  > >  Could you post a sample request sent to Synapse? I think the
> problem
> >  > here
> >  > > is that Synapse "detects" your original request as SOAP. Probably
> this
> >  > is
> >  > > due to the content type of the message. Is there a possibility for
> you
> >  > to
> >  > > use the TCPMon to capture an input message and post it here?
> >  > >
> >  > >  asankha
> >  > >
> >  > >
> >  > >
> >  > >
> >  > >  Ruwan Linton wrote:
> >  > >
> >  > > > Hi Garth,
> >  > > >
> >  > > > Is it the actual web service which returns SOAP as the response
> for
> >  > POX
> >  > > > (XML/HTTP) request, or Synapse. If it is the former you need to
> ask
> >  > this
> >  > > > question from the web service container guys...
> >  > > >
> >  > > > If the request you send to synapse is POX then synapse will
> respond to
> >  > you
> >  > > > as POX regardless of whether it receives a SOAP or POX..
> >  > > >
> >  > > > Could you please clarify the problem a little bit more?
> >  > > >
> >  > > > Thanks,
> >  > > > Ruwan
> >  > > >
> >  > > > On Fri, May 2, 2008 at 3:04 AM, Garth Patil <garthpatil@gmail.com
> >
> >  > wrote:
> >  > > >
> >  > > >
> >  > > >
> >  > > > > Hi All,
> >  > > > > I'm using synapse to proxy a web service that uses XML over
> HTTP. My
> >  > > > > configuration looks like this:
> >  > > > > <definitions xmlns= "http://ws.apache.org/ns/synapse">
> >  > > > >  <proxy name="TestProxy">
> >  > > > >   <target>
> >  > > > >     <endpoint>
> >  > > > >       <address uri="http://someremoteservice.com/msg"
> format="pox"
> >  > />
> >  > > > >     </endpoint>
> >  > > > >     <inSequence>
> >  > > > >       <log level= "full" />
> >  > > > >     </inSequence>
> >  > > > >     <outSequence>
> >  > > > >       <log level= "full" />
> >  > > > >       <send />
> >  > > > >     </outSequence>
> >  > > > >   </target>
> >  > > > >  </proxy>
> >  > > > > </definitions>
> >  > > > >
> >  > > > > I post XML to localhost:8080/soap/TestProxy, and synapse passes
> it
> >  > to
> >  > > > > the specified endpoint without changing it. The remote service
> >  > returns
> >  > > > > XML which is wrapped in soapenv:Body and soapenv:Envelope tags.
> Is
> >  > > > > there a way to specify that the response (like the request)
> remain
> >  > > > > unadulterated by SOAP tags?
> >  > > > > Thanks,
> >  > > > > Garth
> >  > > > >
> >  > > > >
> >  > > > >
> >  > > >
> >  > > >
> >  > > >
> >  > > >
> >  > > >
> >  > >
> >  >
> >
> >
> >
> >
> >
> > --
> >  Ruwan Linton
> >  http://www.wso2.org - "Oxygenating the Web Services Platform"
> >
>



-- 
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"

Re: Eliminating soap envelope from XML

Posted by Garth Patil <ga...@gmail.com>.
log4j.category.org.apache.synapse=DEBUG
log attached.
Thanks,
Garth

On Fri, May 2, 2008 at 10:37 AM, Ruwan Linton <ru...@gmail.com> wrote:
> Hi Garth,
>
>  Thanks for the information, could you please send us the synapse DEBUG log
>  as well. You can change the log level by editing the lib/log4j.properties
>  file to enable DEBUG logs.
>
>  Thanks,
>  Ruwan
>
>
>
>  On Fri, May 2, 2008 at 10:56 PM, Garth Patil <ga...@gmail.com> wrote:
>
>  > The request and response from the actual service is not SOAP. It is
>  > just XML. While I understand that synapse is very SOAP-centric, in
>  > this case, I want to use synapse to proxy the request for logging.
>  > The request to synapse looks like this:
>  >
>  > <?xml version="1.0" ?>
>  > <request>
>  >  <message>
>  >    <recipient>abc1234</recipient>
>  >    <text>Test message.</text>
>  >  </message>
>  > </request>
>  >
>  > Synapse passes the request on to the actual service without changing
>  > the XML. The request to the actual service looks exactly the same
>  > The response from the actual service looks like this:
>  >
>  > <?xml version="1.0" ?>
>  > <response>
>  >  <requestId>F81D4FAE-7DEC-11D0-A765-00A0C91E6BF6</requestId>
>  >  <status>1status>
>  > </response>
>  >
>  > But the response returned by synapse adds the soapenv:Body and
>  > soapenv:Envelope tags to the response:
>  >
>  > <?xml version="1.0" ?>
>  > <soapenv:Envelope>
>  >  <soapenv:Body>
>  >    <response>
>  >      <requestId>F81D4FAE-7DEC-11D0-A765-00A0C91E6BF6</requestId>
>  >      <status>1status>
>  >    </response>
>  >  </soapenv:Body>
>  > </soapenv:Envelope>
>  >
>  > Thanks to everyone for the help.
>  > Best,
>  > Garth
>  >
>  > On Thu, May 1, 2008 at 10:11 PM, Asankha C. Perera <as...@wso2.com>
>  > wrote:
>  > > Garth
>  > >
>  > >  Could you post a sample request sent to Synapse? I think the problem
>  > here
>  > > is that Synapse "detects" your original request as SOAP. Probably this
>  > is
>  > > due to the content type of the message. Is there a possibility for you
>  > to
>  > > use the TCPMon to capture an input message and post it here?
>  > >
>  > >  asankha
>  > >
>  > >
>  > >
>  > >
>  > >  Ruwan Linton wrote:
>  > >
>  > > > Hi Garth,
>  > > >
>  > > > Is it the actual web service which returns SOAP as the response for
>  > POX
>  > > > (XML/HTTP) request, or Synapse. If it is the former you need to ask
>  > this
>  > > > question from the web service container guys...
>  > > >
>  > > > If the request you send to synapse is POX then synapse will respond to
>  > you
>  > > > as POX regardless of whether it receives a SOAP or POX..
>  > > >
>  > > > Could you please clarify the problem a little bit more?
>  > > >
>  > > > Thanks,
>  > > > Ruwan
>  > > >
>  > > > On Fri, May 2, 2008 at 3:04 AM, Garth Patil <ga...@gmail.com>
>  > wrote:
>  > > >
>  > > >
>  > > >
>  > > > > Hi All,
>  > > > > I'm using synapse to proxy a web service that uses XML over HTTP. My
>  > > > > configuration looks like this:
>  > > > > <definitions xmlns= "http://ws.apache.org/ns/synapse">
>  > > > >  <proxy name="TestProxy">
>  > > > >   <target>
>  > > > >     <endpoint>
>  > > > >       <address uri="http://someremoteservice.com/msg" format="pox"
>  > />
>  > > > >     </endpoint>
>  > > > >     <inSequence>
>  > > > >       <log level= "full" />
>  > > > >     </inSequence>
>  > > > >     <outSequence>
>  > > > >       <log level= "full" />
>  > > > >       <send />
>  > > > >     </outSequence>
>  > > > >   </target>
>  > > > >  </proxy>
>  > > > > </definitions>
>  > > > >
>  > > > > I post XML to localhost:8080/soap/TestProxy, and synapse passes it
>  > to
>  > > > > the specified endpoint without changing it. The remote service
>  > returns
>  > > > > XML which is wrapped in soapenv:Body and soapenv:Envelope tags. Is
>  > > > > there a way to specify that the response (like the request) remain
>  > > > > unadulterated by SOAP tags?
>  > > > > Thanks,
>  > > > > Garth
>  > > > >
>  > > > >
>  > > > >
>  > > >
>  > > >
>  > > >
>  > > >
>  > > >
>  > >
>  >
>
>
>
>
>
> --
>  Ruwan Linton
>  http://www.wso2.org - "Oxygenating the Web Services Platform"
>

Re: Eliminating soap envelope from XML

Posted by Ruwan Linton <ru...@gmail.com>.
Hi Garth,

Thanks for the information, could you please send us the synapse DEBUG log
as well. You can change the log level by editing the lib/log4j.properties
file to enable DEBUG logs.

Thanks,
Ruwan

On Fri, May 2, 2008 at 10:56 PM, Garth Patil <ga...@gmail.com> wrote:

> The request and response from the actual service is not SOAP. It is
> just XML. While I understand that synapse is very SOAP-centric, in
> this case, I want to use synapse to proxy the request for logging.
> The request to synapse looks like this:
>
> <?xml version="1.0" ?>
> <request>
>  <message>
>    <recipient>abc1234</recipient>
>    <text>Test message.</text>
>  </message>
> </request>
>
> Synapse passes the request on to the actual service without changing
> the XML. The request to the actual service looks exactly the same
> The response from the actual service looks like this:
>
> <?xml version="1.0" ?>
> <response>
>  <requestId>F81D4FAE-7DEC-11D0-A765-00A0C91E6BF6</requestId>
>  <status>1status>
> </response>
>
> But the response returned by synapse adds the soapenv:Body and
> soapenv:Envelope tags to the response:
>
> <?xml version="1.0" ?>
> <soapenv:Envelope>
>  <soapenv:Body>
>    <response>
>      <requestId>F81D4FAE-7DEC-11D0-A765-00A0C91E6BF6</requestId>
>      <status>1status>
>    </response>
>  </soapenv:Body>
> </soapenv:Envelope>
>
> Thanks to everyone for the help.
> Best,
> Garth
>
> On Thu, May 1, 2008 at 10:11 PM, Asankha C. Perera <as...@wso2.com>
> wrote:
> > Garth
> >
> >  Could you post a sample request sent to Synapse? I think the problem
> here
> > is that Synapse "detects" your original request as SOAP. Probably this
> is
> > due to the content type of the message. Is there a possibility for you
> to
> > use the TCPMon to capture an input message and post it here?
> >
> >  asankha
> >
> >
> >
> >
> >  Ruwan Linton wrote:
> >
> > > Hi Garth,
> > >
> > > Is it the actual web service which returns SOAP as the response for
> POX
> > > (XML/HTTP) request, or Synapse. If it is the former you need to ask
> this
> > > question from the web service container guys...
> > >
> > > If the request you send to synapse is POX then synapse will respond to
> you
> > > as POX regardless of whether it receives a SOAP or POX..
> > >
> > > Could you please clarify the problem a little bit more?
> > >
> > > Thanks,
> > > Ruwan
> > >
> > > On Fri, May 2, 2008 at 3:04 AM, Garth Patil <ga...@gmail.com>
> wrote:
> > >
> > >
> > >
> > > > Hi All,
> > > > I'm using synapse to proxy a web service that uses XML over HTTP. My
> > > > configuration looks like this:
> > > > <definitions xmlns= "http://ws.apache.org/ns/synapse">
> > > >  <proxy name="TestProxy">
> > > >   <target>
> > > >     <endpoint>
> > > >       <address uri="http://someremoteservice.com/msg" format="pox"
> />
> > > >     </endpoint>
> > > >     <inSequence>
> > > >       <log level= "full" />
> > > >     </inSequence>
> > > >     <outSequence>
> > > >       <log level= "full" />
> > > >       <send />
> > > >     </outSequence>
> > > >   </target>
> > > >  </proxy>
> > > > </definitions>
> > > >
> > > > I post XML to localhost:8080/soap/TestProxy, and synapse passes it
> to
> > > > the specified endpoint without changing it. The remote service
> returns
> > > > XML which is wrapped in soapenv:Body and soapenv:Envelope tags. Is
> > > > there a way to specify that the response (like the request) remain
> > > > unadulterated by SOAP tags?
> > > > Thanks,
> > > > Garth
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > >
> >
>



-- 
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"

Re: Eliminating soap envelope from XML

Posted by Garth Patil <ga...@gmail.com>.
The request and response from the actual service is not SOAP. It is
just XML. While I understand that synapse is very SOAP-centric, in
this case, I want to use synapse to proxy the request for logging.
The request to synapse looks like this:

<?xml version="1.0" ?>
<request>
  <message>
    <recipient>abc1234</recipient>
    <text>Test message.</text>
  </message>
</request>

Synapse passes the request on to the actual service without changing
the XML. The request to the actual service looks exactly the same
The response from the actual service looks like this:

<?xml version="1.0" ?>
<response>
  <requestId>F81D4FAE-7DEC-11D0-A765-00A0C91E6BF6</requestId>
  <status>1status>
</response>

But the response returned by synapse adds the soapenv:Body and
soapenv:Envelope tags to the response:

<?xml version="1.0" ?>
<soapenv:Envelope>
  <soapenv:Body>
    <response>
      <requestId>F81D4FAE-7DEC-11D0-A765-00A0C91E6BF6</requestId>
      <status>1status>
    </response>
  </soapenv:Body>
</soapenv:Envelope>

Thanks to everyone for the help.
Best,
Garth

On Thu, May 1, 2008 at 10:11 PM, Asankha C. Perera <as...@wso2.com> wrote:
> Garth
>
>  Could you post a sample request sent to Synapse? I think the problem here
> is that Synapse "detects" your original request as SOAP. Probably this is
> due to the content type of the message. Is there a possibility for you to
> use the TCPMon to capture an input message and post it here?
>
>  asankha
>
>
>
>
>  Ruwan Linton wrote:
>
> > Hi Garth,
> >
> > Is it the actual web service which returns SOAP as the response for POX
> > (XML/HTTP) request, or Synapse. If it is the former you need to ask this
> > question from the web service container guys...
> >
> > If the request you send to synapse is POX then synapse will respond to you
> > as POX regardless of whether it receives a SOAP or POX..
> >
> > Could you please clarify the problem a little bit more?
> >
> > Thanks,
> > Ruwan
> >
> > On Fri, May 2, 2008 at 3:04 AM, Garth Patil <ga...@gmail.com> wrote:
> >
> >
> >
> > > Hi All,
> > > I'm using synapse to proxy a web service that uses XML over HTTP. My
> > > configuration looks like this:
> > > <definitions xmlns= "http://ws.apache.org/ns/synapse">
> > >  <proxy name="TestProxy">
> > >   <target>
> > >     <endpoint>
> > >       <address uri="http://someremoteservice.com/msg" format="pox" />
> > >     </endpoint>
> > >     <inSequence>
> > >       <log level= "full" />
> > >     </inSequence>
> > >     <outSequence>
> > >       <log level= "full" />
> > >       <send />
> > >     </outSequence>
> > >   </target>
> > >  </proxy>
> > > </definitions>
> > >
> > > I post XML to localhost:8080/soap/TestProxy, and synapse passes it to
> > > the specified endpoint without changing it. The remote service returns
> > > XML which is wrapped in soapenv:Body and soapenv:Envelope tags. Is
> > > there a way to specify that the response (like the request) remain
> > > unadulterated by SOAP tags?
> > > Thanks,
> > > Garth
> > >
> > >
> > >
> >
> >
> >
> >
> >
>

Re: Eliminating soap envelope from XML

Posted by "Asankha C. Perera" <as...@wso2.com>.
Garth

Could you post a sample request sent to Synapse? I think the problem 
here is that Synapse "detects" your original request as SOAP. Probably 
this is due to the content type of the message. Is there a possibility 
for you to use the TCPMon to capture an input message and post it here?

asankha


Ruwan Linton wrote:
> Hi Garth,
>
> Is it the actual web service which returns SOAP as the response for POX
> (XML/HTTP) request, or Synapse. If it is the former you need to ask this
> question from the web service container guys...
>
> If the request you send to synapse is POX then synapse will respond to you
> as POX regardless of whether it receives a SOAP or POX..
>
> Could you please clarify the problem a little bit more?
>
> Thanks,
> Ruwan
>
> On Fri, May 2, 2008 at 3:04 AM, Garth Patil <ga...@gmail.com> wrote:
>
>   
>> Hi All,
>> I'm using synapse to proxy a web service that uses XML over HTTP. My
>> configuration looks like this:
>> <definitions xmlns= "http://ws.apache.org/ns/synapse">
>>  <proxy name="TestProxy">
>>    <target>
>>      <endpoint>
>>        <address uri="http://someremoteservice.com/msg" format="pox" />
>>      </endpoint>
>>      <inSequence>
>>        <log level= "full" />
>>      </inSequence>
>>      <outSequence>
>>        <log level= "full" />
>>        <send />
>>      </outSequence>
>>    </target>
>>  </proxy>
>> </definitions>
>>
>> I post XML to localhost:8080/soap/TestProxy, and synapse passes it to
>> the specified endpoint without changing it. The remote service returns
>> XML which is wrapped in soapenv:Body and soapenv:Envelope tags. Is
>> there a way to specify that the response (like the request) remain
>> unadulterated by SOAP tags?
>> Thanks,
>> Garth
>>
>>     
>
>
>
>   

Re: Eliminating soap envelope from XML

Posted by Ruwan Linton <ru...@gmail.com>.
Hi Garth,

Is it the actual web service which returns SOAP as the response for POX
(XML/HTTP) request, or Synapse. If it is the former you need to ask this
question from the web service container guys...

If the request you send to synapse is POX then synapse will respond to you
as POX regardless of whether it receives a SOAP or POX..

Could you please clarify the problem a little bit more?

Thanks,
Ruwan

On Fri, May 2, 2008 at 3:04 AM, Garth Patil <ga...@gmail.com> wrote:

> Hi All,
> I'm using synapse to proxy a web service that uses XML over HTTP. My
> configuration looks like this:
> <definitions xmlns= "http://ws.apache.org/ns/synapse">
>  <proxy name="TestProxy">
>    <target>
>      <endpoint>
>        <address uri="http://someremoteservice.com/msg" format="pox" />
>      </endpoint>
>      <inSequence>
>        <log level= "full" />
>      </inSequence>
>      <outSequence>
>        <log level= "full" />
>        <send />
>      </outSequence>
>    </target>
>  </proxy>
> </definitions>
>
> I post XML to localhost:8080/soap/TestProxy, and synapse passes it to
> the specified endpoint without changing it. The remote service returns
> XML which is wrapped in soapenv:Body and soapenv:Envelope tags. Is
> there a way to specify that the response (like the request) remain
> unadulterated by SOAP tags?
> Thanks,
> Garth
>



-- 
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"