Hi Santoso,
no, the header looks like ok. What I think is that the problems comes
from the call:
ConfigurationContext configContext =
ConfigurationContextFactory.createConfigurationContextFromFileSystem("c:\\MyJavaStuff\\axis2",
null);
try to use the default constructor for ServiceClient (you'll need the
axis2 libs in the classpath in order to engage the addressing module)
Michele
Santoso Nugroho wrote:
> Hi Michele,
>
> The soapaction is correct, and I got AxisFault : Invalid message addition
> What is meant by "Invalid Message Addition"? is it because of the headers?
>
> here are the sample soap message sent
> <?xml version='1.0' encoding='utf-8'?>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:wsa="http://www.w3.org/2005/08/addressing">
> <soapenv:Header>
>
> <wsa:To>http://localhost:8081/axis2/services/AsynchWrappedService</wsa:To>
> <wsa:ReplyTo>
>
> <wsa:Address>http://192.168.1.22:6060/axis2/services/__ANONYMOUS_SERVICE__/__OPERATION_OUT_IN__</wsa:Address>
>
> </wsa:ReplyTo>
> <wsa:MessageID>urn:uuid:C3B147D7E64C6C375111564787858281</wsa:MessageID>
> <wsa:Action>requestData</wsa:Action>
> </soapenv:Header>
> <soapenv:Body>
> <ns:requestData xmlns:ns="http://www.example.org/AsynchWrappedService">
> <ns:key>hello, this is the key</ns:key>
> </ns:requestData>
> </soapenv:Body>
> </soapenv:Envelope>
>
> here are the exception i got
>
> <?xml version='1.0' encoding='utf-8'?>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
> <soapenv:Header />
> <soapenv:Body>
> <soapenv:Fault>
> <faultcode>soapenv:Client</faultcode>
> <faultstring>Invalid message addition , operation context
> completed</faultstring>
> <detail>
> <Exception>
> org.apache.axis2.AxisFault: Invalid message addition ,
> operation context completed
> at
> org.apache.axis2.description.InOnlyAxisOperation.addMessageContext(InOnlyAxisOperation.java:62)
>
> at
> org.apache.axis2.context.OperationContext.addMessageContext(OperationContext.java:85)
>
> at
> org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:35)
>
> at
> org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:454)
> at
> org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:284)
>
> at
> org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:136)
>
> at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
>
> at
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
>
> at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>
> at
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
>
> at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
>
> at java.lang.Thread.run(Unknown Source)
> </Exception>
> </detail>
> </soapenv:Fault>
> </soapenv:Body>
> </soapenv:Envelope>
>
> Thanks,
>
> Santoso
>
> Michele Mazzucco wrote:
>> Hi Santoso,
>>
>> are you sure that the soap action is correct, i.e. the same declared
>> into services.xml? It should look like
>>
>> <operation name="requestData">
>> <messageReceiver
>>
>> class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />
>> <actionMapping> requestData </actionMapping>
>> </operation>
>>
>>
>> Are you sure that your service is called? Try to add some logging
>> statements inside your code
>>
>>
>> Hope this helps,
>> Michele
>>
>> On 24 Aug 2006, at 04:30, Santoso Nugroho wrote:
>>
>>> Hi Michele,
>>>
>>> I've change the return type, however the callback is still not called.
>>> Here is my service code :
>>> public OMElement requestData(OMElement element) {
>>> OMElement result = buildResponse(element);
>>> return result;
>>> }
>>>
>>> Here is my client code :
>>> OMElement payload = getPayload();
>>> Options options = new Options();
>>> options.setAction("requestData");
>>> options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
>>> options.setUseSeparateListener(true);
>>> EndpointReference epr = new
>>> EndpointReference("http://localhost:8081/axis2/services/AsynchWrappedService");
>>>
>>> options.setTo(epr);
>>> Callback callback = new Callback() {
>>> public void onComplete(AsyncResult arg0) {
>>> System.out.println("completed, result =
>>> "+arg0.getResponseEnvelope());
>>> }
>>>
>>> public void onError(Exception arg0) {
>>> arg0.printStackTrace();
>>> }
>>> };
>>> ServiceClient serviceClient = null;
>>> try {
>>> ConfigurationContext configContext =
>>> ConfigurationContextFactory.createConfigurationContextFromFileSystem("c:\\MyJavaStuff\\axis2",
>>> null);
>>> serviceClient = new ServiceClient(configContext,null);
>>> serviceClient.engageModule(new
>>> QName(Constants.MODULE_ADDRESSING));
>>> serviceClient.setOptions(options);
>>> serviceClient.sendReceiveNonBlocking(payload, callback);
>>> while(!callback.isComplete()) {
>>> Thread.sleep(1000);
>>> }
>>> } catch (AxisFault e) {
>>> // TODO Auto-generated catch block
>>> e.printStackTrace();
>>> } catch (Exception e) {
>>> e.printStackTrace();
>>> } finally {
>>> try {
>>> serviceClient.finalizeInvoke();
>>> } catch (AxisFault e) {
>>> // TODO Auto-generated catch block
>>> e.printStackTrace();
>>> }
>>> }
>>>
>>> What is wrong with my code?
>>>
>>> Thanks
>>>
>>> Santoso
>>>
>>>
>>> Michele Mazzucco wrote:
>>>> Hi Santoso,
>>>>
>>>>
>>>> I thinks you are making a mistake: asynchronous does not mean that the
>>>> return type is void!, it means that the client does not block while the
>>>> request is processed.
>>>> The return type should then be OMElement, and the callback object will
>>>> collect the result when this will be available.
>>>>
>>>> Regards,
>>>> Michele
>>>>
>>>> Santoso Nugroho wrote:
>>>>
>>>>> Hi all,
>>>>>
>>>>> I have an asynch service, which as I understand the operation method
>>>>> signature returns void.
>>>>> e.g. public void requestData(OMElement element) { ... }
>>>>>
>>>>> On the client side, I call the service using
>>>>> ServiceClient.sendReceiveNonBlocking(payload, callback)
>>>>> and I also engage the Addressing module.
>>>>>
>>>>> My question is, when requestData is processed, what is the code to
>>>>> return the result to the client's callback?
>>>>> Is it the same code as a client calling a service?
>>>>> fyi, I already have the ReplyTo address and the MessageID (from
>>>>> MessageContext).
>>>>>
>>>>>
>>>>> Thanks a lot,
>>>>>
>>>>> Santoso
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]