On 7/18/07, Kelvin Lin <[EMAIL PROTECTED]> wrote:

Hi Nabeel,

Thanks for your reply.

I still have another question, it is how to add more than one namespace
into the soap message, if just encapsulate payload lilke
<ns1:getQuote><ns1:symbol>IBM</ns1:symbol></ns1:getQuote>

here is console message:

AXIS2C_HOME is not set - log is written to . dir
Using endpoint :
http://localhost:9081/WebProject/services/StockQuoteService

Sending OM : <ns1:getQuote><ns1:symbol>IBM</ns1:symbol></ns1:getQuote>

Here is tcpmon message:

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";><soapenv:Header></soapenv:Header><soapenv:Body><ns1:getQuote><ns1:symbol>IBM</ns1:symbol></ns1:getQuote></soapenv:Body></soapenv:Envelope>

In other words and in short, how should I do to get tcpmon message like:

<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/1999/XMLSchema"; xmlns:ns1="http://stockquote";>
<SOAP-ENV:Body>
<ns1:getQuote>
<ns1:symbol>IBM</ns1:symbol>
</ns1:getQuote>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


svc_client API allows you to touch neither envelope nor body node directly.
This is in keeping with WS-I basic profile. If you want to have additional
namespaces you can to attach them to the payload. In your case, I don't see
the need to have the namespaces SOAP-ENC, xsi and xsd in the envelope. Even
if you need them, you can always define them in the payload. For your
message, you should be able to attach ns1 to the getQuote element and get it
working.

<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";>
<SOAP-ENV:Body>
<ns1:getQuote xmlns:ns1="http://stockquote";>
<ns1:symbol>IBM</ns1:symbol>
</ns1:getQuote>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

p.s. Whether there must be existing <soapenv:Header> and <soapenv:Body> if I
use Axis2/C to create soap message, or says using AXIOM_SOAP11?


According to SOAP specifications (both 1.1 and 1.2), <header> element is
optional, meaning a receiving service may or may not process header
information. Axis2/C engine by default adds empty <header> element. It is
not a bug but IMO the engine should avoid adding empty headers if the
service consumer does not intend to send any headers with the SOAP message.
I am not sure if someone has already raised a JIRA regarding this. In any
case, header element shouldn't be a problem for you to get your client
working.


Nabeel.

Thanks a lot.




*Nabeel Yoosuf <[EMAIL PROTECTED]>* wrote:



On 7/16/07, Kelvin Lin <[EMAIL PROTECTED]> wrote:
>
> Hi Dinesh,
>
> Thanks a lot for your reply.
>
> I followed your suggestion, specifying SOAP1.1 explicitly. But it failed
> either.
>
> Here are the codes:
>
>     /* Setup options */
>     options = axis2_options_create(env);
>     axis2_options_set_to(options, env, endpoint_ref);
>     axis2_options_set_soap_version(options, env, AXIOM_SOAP11);
>
> Here are the console output, based on sample echo.c, together with the
> official release:
>
> AXIS2C_HOME is not set - log is written to . dir
> Using endpoint :
> http://localhost:9081/WebProject/services/StockQuoteService
> Sending OM : <SOAP-ENV:Envelope xmlns:ns1=" http://stockquote";
> xmlns:xsi="http://
> www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENC="
> http://schemas.xmlsoap.org/s
> oap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
> xmlns:
> 
xsd="http://www.w3.org/1999/XMLSchema";><SOAP-ENV:Body><ns1:getQuote><ns1:symbol<http://www.w3.org/1999/XMLSchema%22%3E%3CSOAP-ENV:Body%3E%3Cns1:getQuote%3E%3Cns1:symbol>
> >
> IBM</ns1:symbol></ns1:getQuote></SOAP-ENV:Body></SOAP-ENV:Envelope>
>
> Received OM : <soapenv:Fault><faultcode xmlns="">Server.generalException
> </faultc
> ode><faultstring xmlns="">WSWS3277E: Error: No such operation
> 'Envelope'</faults
> tring><detail xmlns=""></detail></soapenv:Fault>
> echo client invoke SUCCESSFUL!
>
> and here are the monitor data catched by tcpmon:
>
> POST /WebProject/services/StockQuoteService HTTP/1.1
> User-Agent: Axis2/C
> SOAPAction: ""
> Content-Length: 531
> Content-Type: text/xml;charset=UTF-8
> Host: localhost:9081
> <soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";><soapenv:Header></soapenv:Header><soapenv:Body><SOAP-ENV:Envelope<http://schemas.xmlsoap.org/soap/envelope/%22%3E%3Csoapenv:Header%3E%3C/soapenv:Header%3E%3Csoapenv:Body%3E%3CSOAP-ENV:Envelope>xmlns:ns1="http://stockquote";
> xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"; xmlns:SOAP-ENC="
> http://schemas.xmlsoap.org/soap/encoding/"; 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
> 
xmlns:xsd="http://www.w3.org/1999/XMLSchema";><SOAP-ENV:Body><ns1:getQuote><ns1:symbol>IBM</ns1:symbol></ns1:getQuote></SOAP-ENV:Body></SOAP-ENV:Envelope></soapenv:Body></soapenv:Envelope
> >
>
> It still adds some additional data like "header" and "body".
>
> What's happed?
>

You only need to build the payload and pass it to
axis2_svc_client_send_receive.

The payload:
<ns1:getQuote><ns1:symbol>IBM</ns1:symbol></ns1:getQuote>

By looking at the namespace of the envelope 
(http://schemas.xmlsoap.org/soap/envelope/<http://schemas.xmlsoap.org/soap/envelope/%22%3E%3Csoapenv:Header%3E%3C/soapenv:Header%3E%3Csoapenv:Body%3E%3CSOAP-ENV:Envelope>),
you need to use SOAP 1.1 instead of SOAP 1.2. That's why you need to set
the version (Otherwise the engine assumes the default version 1.2).

axis2_options_set_soap_version(options, env, AXIOM_SOAP11);


By the way, what is this three statements' effect?
>
>     soap_action = axutil_string_create(env, 
"http://ws.apache.org/axis2/c/samples/echo/soap_action
> ");
>     axis2_options_set_soap_action(options, env, soap_action);
>     axutil_string_free(soap_action, env);
> What does soap_action mean?
>


When using SOAP 1.1 (over HTTP), you MUST set SOAPAction HTTP header which
is usually used to identify the intent of the  SOAP action.  The value we
set is a URI identifying the intent. For the above code, you'll see the
following HTTP header.

SOAPAction: "http://ws.apache.org/axis2/c/samples/echo/soap_action";


Hope this helps.

Nabeel.

Thanks a lot.
>
> *Dinesh Premalal <[EMAIL PROTECTED]>* wrote:
>
> Kelvin Lin writes:
> >
> > I used printf to display om_str is:
> >
> > Sending OM :
> > ABC> SOAP-ENV:Envelope>
> >
> > But I used tcpmon to monitor is:
> >
> >
> > > 'http://www.w3.org/1999/XMLSchema-instance ' xmlns:SOAP-ENC =
> 'http://
> > schemas.xmlsoap.org/soap/encoding/' xmlns:xsd = '
> http://www.w3.org/1999/
> > XMLSchema'>ABC> ns1:getQuote>> soapenv:Envelope>
> >
> > I want the exactly soap message is:
> >
> > > xmlns:SOAP-ENC=" http://schemas.xmlsoap.org/soap/encoding/";
> xmlns:xsi="http://
> > www.w3.org/1999/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/1999/XMLSchema
> > " xmlns:ns1="http://stockquote";>
> >
> >
> > IBM
> >
> >
> >
> >
> > Why could be this? I have no any idea. How should I do, then I can get
> the soap
> > message I want.
> This because your service client send SOAP1.2 message. If you need to
> use SOAP1.1 need to tell it explicitly.
>
> axis2_options_set_soap_version(options, env, AXIOM_SOAP11);
>
> option will work. Please refer echo_blocking_soap11 [1] sample for
> more information.
>
> thanks,
> Dinesh
>
>
> 
[1].http://svn.apache.org/repos/asf/webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking_soap11.c
>
> --
> Dinesh Premalal
> http://xydinesh.wordpress.com/
> GPG ID : A255955C
> GPG Key Finger Print : C481 E5D4 C27E DC34 9257 0229 4F44 266E A255 955C
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
> Best Regards!
>
> Kelvin.Lin
> ------------------------------
> Boardwalk for $500? In 2007? Ha!
> Play Monopoly Here and 
Now<http://us.rd.yahoo.com/evt=48223/*http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow>(it's
 updated for today's economy) at Yahoo! Games.
>



--
http://www.cs.purdue.edu
http://mohamednabeel.blogspot.com




Best Regards!

Kelvin.Lin

------------------------------
Boardwalk for $500? In 2007? Ha!
Play Monopoly Here and 
Now<http://us.rd.yahoo.com/evt=48223/*http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow>(it's
 updated for today's economy) at Yahoo! Games.




--
http://www.cs.purdue.edu
http://mohamednabeel.blogspot.com

Reply via email to