axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Bernard <david.bern...@silverbrookresearch.com>
Subject Re: [axis2c] Adding elements to SOAP envelope header in client
Date Wed, 12 Apr 2006 01:00:27 GMT
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&amp;actId=yyyyy</ns1:SenderKey>

>>
>>         
>> <ns1:ReceiverKey>http://configurer1:8082/axis/services/wfxmlFactoryBinding?procDef=zzz&amp;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&amp;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>
>>
>>
>
>


Mime
View raw message