You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by David Bernard <da...@silverbrookresearch.com> on 2006/04/10 00:23:46 UTC
[axis2c] Adding elements to SOAP envelope header in client
I need to add elements to the soap envelope header before calling a web
service.
The api seems to support specific elements in the soap envelope header
such as AXIS2_MSG_INFO_HEADERS_SET_TO.
Q1.
Having cloned the sample code eg math, what is the best way to add
elements to the soap envelope header?
Q2
At what point has the SOAP envelope been create so that I could get the
envelope and add elements to it?
Q3
Does the api just create stuff as it needs anyway and I could do
Unravelling the sample code
-------------------------------------------------------------------------------------------------------------------------------
stub =
axis2_stub_create_with_endpoint_uri_and_client_home(&env, address,
client_home);
AXIS2_STUB_SET_TRANSPORT_INFO(stub, &env, AXIS2_TRANSPORT_HTTP,
AXIS2_TRANSPORT_HTTP, AXIS2_FALSE);
call = AXIS2_STUB_GET_CALL_OBJ(stub, env);
ret_node = AXIS2_CALL_INVOKE_BLOCKING_WITH_OM(call, env,
"CreateInstanceRq", node);
This is format of the request I am trying to send. (ASAP/wfxml protocol)
------------------------------------------------------------------------------------------------------------------------------
<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">
<soapenv:Header>
<ns1:Request xmlns:ns1="http://www.oasis-open.org/asap/0.9/asap.xsd">
<ns1:SenderKey>http://192.168.157.3:8081/qa/axis/asapObserverBinding?procId=xxx&actId=yyyyy</ns1:SenderKey>
<ns1:ReceiverKey>http://configurer1:8082/axis/services/wfxmlFactoryBinding?procDef=zzz&packageId=aaaaaar</ns1:ReceiverKey>
<ns1:ResponseRequired>Yes</ns1:ResponseRequired>
</ns1:Request>
</soapenv:Header>
<soapenv:Body>
<CreateInstanceRq xmlns="http://www.oasis-open.org/asap/0.9/asap.xsd">
<StartImmediately>true</StartImmediately>
<ObserverKey>http://192.168.157.3:8081/qa/axis/asapObserverBinding?procId=xxx&actId=yyyyy</ObserverKey>
<Name>xxxxx_yyyyyy</Name>
<Subject>xxxxxx_yyyyyy</Subject>
<Description>xxxxxxx.</Description>
<ContextData>
<action xmlns="">START</action>
<currentState xmlns="">NOT_RUNNING_STARTING</currentState>
<id xmlns="">10001</id>
<message xmlns=""></message>
<newState xmlns="">RUNNING</newState>
<status xmlns=""></status>
</ContextData>
</CreateInstanceRq>
</soapenv:Body></soapenv:Envelope>
Re: [axis2c] Adding elements to SOAP envelope header in client
Posted by David Bernard <da...@silverbrookresearch.com>.
Thanks Samisa,
Did the trick.
David Bernard
Samisa Abeysinghe wrote:
> David Bernard wrote:
>
>> I need to add elements to the soap envelope header before calling a
>> web service.
>>
>> The api seems to support specific elements in the soap envelope
>> header such as AXIS2_MSG_INFO_HEADERS_SET_TO.
>>
>> Q1.
>> Having cloned the sample code eg math, what is the best way to add
>> elements to the soap envelope header?
>
>
> Please have a look at the addr_echo sample.
> After the following line you can access the SOAP envelope throuhg the
> message context and set the headers.
> msg_ctx = AXIS2_MEP_CLIENT_PREPARE_SOAP_ENVELOPE(mep_client, &env, node);
>
> you can do the following:
> axis2_soap_envelope_t *envelope =
> AXIS2_MSG_CTX_GET_SOAP_ENVELOPE(msg_ctx, &env);
> Then use the API of soap_envelope to get the soap_header and use the
> soap_header API. Please have a look at the header files for the API.
>
>>
>> Q2
>> At what point has the SOAP envelope been create so that I could get
>> the envelope and add elements to it?
>
>
> When you use the API of call, you have more control to manupulate the
> SOAP stuff, and the soap envelope is crated after the call to
> AXIS2_MEP_CLIENT_PREPARE_SOAP_ENVELOPE
>
>>
>> Q3
>> Does the api just create stuff as it needs anyway and I could do
>
>
> Please use the addr_echo sample as I mentioned earlier if you want
> more control.
>
> P.S. In line with the altest Axis2 Java API, we plan to provide the
> operation client and service client APIs very soon.
> We hope your life would be much easy once those APIs are provided.
>
> Thanks,
> Samisa...
>
>>
>> Unravelling the sample code
>> -------------------------------------------------------------------------------------------------------------------------------
>>
>> stub =
>> axis2_stub_create_with_endpoint_uri_and_client_home(&env,
>> address,
>> client_home);
>> AXIS2_STUB_SET_TRANSPORT_INFO(stub, &env, AXIS2_TRANSPORT_HTTP,
>> AXIS2_TRANSPORT_HTTP, AXIS2_FALSE);
>>
>>
>> call = AXIS2_STUB_GET_CALL_OBJ(stub, env);
>> ret_node = AXIS2_CALL_INVOKE_BLOCKING_WITH_OM(call, env,
>> "CreateInstanceRq", node);
>>
>>
>> This is format of the request I am trying to send. (ASAP/wfxml protocol)
>> ------------------------------------------------------------------------------------------------------------------------------
>>
>> <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">
>> <soapenv:Header>
>> <ns1:Request
>> xmlns:ns1="http://www.oasis-open.org/asap/0.9/asap.xsd">
>>
>> <ns1:SenderKey>http://192.168.157.3:8081/qa/axis/asapObserverBinding?procId=xxx&actId=yyyyy</ns1:SenderKey>
>>
>>
>> <ns1:ReceiverKey>http://configurer1:8082/axis/services/wfxmlFactoryBinding?procDef=zzz&packageId=aaaaaar</ns1:ReceiverKey>
>>
>> <ns1:ResponseRequired>Yes</ns1:ResponseRequired>
>> </ns1:Request>
>> </soapenv:Header>
>> <soapenv:Body>
>> <CreateInstanceRq
>> xmlns="http://www.oasis-open.org/asap/0.9/asap.xsd">
>> <StartImmediately>true</StartImmediately>
>>
>> <ObserverKey>http://192.168.157.3:8081/qa/axis/asapObserverBinding?procId=xxx&actId=yyyyy</ObserverKey>
>>
>> <Name>xxxxx_yyyyyy</Name>
>> <Subject>xxxxxx_yyyyyy</Subject>
>> <Description>xxxxxxx.</Description>
>> <ContextData>
>> <action xmlns="">START</action>
>> <currentState xmlns="">NOT_RUNNING_STARTING</currentState>
>> <id xmlns="">10001</id>
>> <message xmlns=""></message>
>> <newState xmlns="">RUNNING</newState>
>> <status xmlns=""></status>
>> </ContextData>
>> </CreateInstanceRq>
>> </soapenv:Body></soapenv:Envelope>
>>
>>
>
>
Re: [axis2c] Adding elements to SOAP envelope header in client
Posted by Samisa Abeysinghe <sa...@gmail.com>.
Pete Robbins wrote:
> Here is what I'm trying to do. Please tell me my mistakes ;-)
>
> A) extract axis2c tree from svn
> B) as per the instructions run ./configure
>
> Problem 1: there is no configure script in the svn tree
> Solution?: I used the autogen.sh script to create the automake files
>
> Problem 2: This gets errors as there are problems in some of the
> Makefile.am <http://Makefile.am> files:
> >> modules/Makefile.am:2: directory should not contain '/'
> >> modules/core/Makefile.am:1: directory should not contain '/'
> These are caused by SUBDIRS = platforms/unix ... which would appear to
> be invalid on my system (RH linux)
>
> The configure script generated is invalid.
> I also get errors because the configure.ac <http://configure.ac> file has:
>
> test/unit/xml/om/Makefile\
> test/core/transport/Makefile\
>
> My system likes a space before the \
>
> I have autoconf version 2.59, automake version 1.6.3
We use automake 1.9.5, it is a real problem to support multiple versions
of automake (infact it is almost impossible with my experiance with Axis
C++)
If you could, please try to upgrade to automake 1.9.5.
Thnaks,
Samisa...
>
> Cheers,
>
>
>
>
>
Re: [axis2c] Adding elements to SOAP envelope header in client
Posted by Pete Robbins <ro...@googlemail.com>.
oops... sorry wrong thread :-(
Re: [axis2c] Adding elements to SOAP envelope header in client
Posted by Pete Robbins <ro...@googlemail.com>.
Here is what I'm trying to do. Please tell me my mistakes ;-)
A) extract axis2c tree from svn
B) as per the instructions run ./configure
Problem 1: there is no configure script in the svn tree
Solution?: I used the autogen.sh script to create the automake files
Problem 2: This gets errors as there are problems in some of the
Makefile.amfiles:
>> modules/Makefile.am:2: directory should not contain '/'
>> modules/core/Makefile.am:1: directory should not contain '/'
These are caused by SUBDIRS = platforms/unix ... which would appear to be
invalid on my system (RH linux)
The configure script generated is invalid.
I also get errors because the configure.ac file has:
test/unit/xml/om/Makefile\
test/core/transport/Makefile\
My system likes a space before the \
I have autoconf version 2.59, automake version 1.6.3
Cheers,
Re: [axis2c] Adding elements to SOAP envelope header in client
Posted by Samisa Abeysinghe <sa...@wso2.com>.
David Bernard wrote:
> I need to add elements to the soap envelope header before calling a
> web service.
>
> The api seems to support specific elements in the soap envelope header
> such as AXIS2_MSG_INFO_HEADERS_SET_TO.
>
> Q1.
> Having cloned the sample code eg math, what is the best way to add
> elements to the soap envelope header?
Please have a look at the addr_echo sample.
After the following line you can access the SOAP envelope throuhg the
message context and set the headers.
msg_ctx = AXIS2_MEP_CLIENT_PREPARE_SOAP_ENVELOPE(mep_client, &env, node);
you can do the following:
axis2_soap_envelope_t *envelope =
AXIS2_MSG_CTX_GET_SOAP_ENVELOPE(msg_ctx, &env);
Then use the API of soap_envelope to get the soap_header and use the
soap_header API. Please have a look at the header files for the API.
>
> Q2
> At what point has the SOAP envelope been create so that I could get
> the envelope and add elements to it?
When you use the API of call, you have more control to manupulate the
SOAP stuff, and the soap envelope is crated after the call to
AXIS2_MEP_CLIENT_PREPARE_SOAP_ENVELOPE
>
> Q3
> Does the api just create stuff as it needs anyway and I could do
Please use the addr_echo sample as I mentioned earlier if you want more
control.
P.S. In line with the altest Axis2 Java API, we plan to provide the
operation client and service client APIs very soon.
We hope your life would be much easy once those APIs are provided.
Thanks,
Samisa...
>
> Unravelling the sample code
> -------------------------------------------------------------------------------------------------------------------------------
>
> stub =
> axis2_stub_create_with_endpoint_uri_and_client_home(&env, address,
> client_home);
> AXIS2_STUB_SET_TRANSPORT_INFO(stub, &env, AXIS2_TRANSPORT_HTTP,
> AXIS2_TRANSPORT_HTTP, AXIS2_FALSE);
>
>
> call = AXIS2_STUB_GET_CALL_OBJ(stub, env);
> ret_node = AXIS2_CALL_INVOKE_BLOCKING_WITH_OM(call, env,
> "CreateInstanceRq", node);
>
>
> This is format of the request I am trying to send. (ASAP/wfxml protocol)
> ------------------------------------------------------------------------------------------------------------------------------
>
> <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">
> <soapenv:Header>
> <ns1:Request
> xmlns:ns1="http://www.oasis-open.org/asap/0.9/asap.xsd">
>
> <ns1:SenderKey>http://192.168.157.3:8081/qa/axis/asapObserverBinding?procId=xxx&actId=yyyyy</ns1:SenderKey>
>
>
> <ns1:ReceiverKey>http://configurer1:8082/axis/services/wfxmlFactoryBinding?procDef=zzz&packageId=aaaaaar</ns1:ReceiverKey>
>
> <ns1:ResponseRequired>Yes</ns1:ResponseRequired>
> </ns1:Request>
> </soapenv:Header>
> <soapenv:Body>
> <CreateInstanceRq
> xmlns="http://www.oasis-open.org/asap/0.9/asap.xsd">
> <StartImmediately>true</StartImmediately>
>
> <ObserverKey>http://192.168.157.3:8081/qa/axis/asapObserverBinding?procId=xxx&actId=yyyyy</ObserverKey>
>
> <Name>xxxxx_yyyyyy</Name>
> <Subject>xxxxxx_yyyyyy</Subject>
> <Description>xxxxxxx.</Description>
> <ContextData>
> <action xmlns="">START</action>
> <currentState xmlns="">NOT_RUNNING_STARTING</currentState>
> <id xmlns="">10001</id>
> <message xmlns=""></message>
> <newState xmlns="">RUNNING</newState>
> <status xmlns=""></status>
> </ContextData>
> </CreateInstanceRq>
> </soapenv:Body></soapenv:Envelope>
>
>