component call another web service

View: New views
4 Messages — Rating Filter:   Alert me  

component call another web service

by Marco Mascia-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a Java class (MyServiceImpl) that I expose as a web service in Mule as shown below.

       <service name="MyService">
            <inbound>
                <cxf:inbound-endpoint address=http://localhost:8888/services/Myservice" />
             </inbound>
            <component class="com.example.MyServiceImpl" />
        </service>

I have an operation called process shown below where I need to
save the request,
directly call or route to another mule proxy web service
save the response

        @WebService(endpointInterface = "com.example.MyService", serviceName = "MyService")
        public class MyServiceImpl implements MyService {
                public MyResponse process(MyRequest request) {

                        // write out request
                        // route or call web service directly
                        // write out response
                        return response;
                }

How do I call a proxy mule webservice within my component? I figure this is the only way to have access to the response.
Can I route it to an outbound endpoint and have access to the response in my component?
Thanks for any suggestions.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: component call another web service

by Andrew Perepelytsya :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Component Bindings.

HTH,
Andrew

Re: component call another web service

by Marco Mascia-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for pointing me in the right direction.
In MyService I have the following component binding.
<binding interface="com.example.services.AnotherService">
        <cxf:outbound-endpoint address="http://localhost:8888/services/anotherservice" proxy="true" />
</binding>

Declared another proxy service which calls the real service.
       <service name="AnotherService">
                <inbound>
        <cxf:inbound-endpoint address="http://localhost:8888/services/anotherservice"
  proxy="true" synchronous="true" />
    </inbound>
                    <outbound>
                        <pass-through-router>
                        <cxf:outbound-endpoint address="http://example.com/test.asmx"
                proxy="true" synchronous="true">
                  </cxf:outbound-endpoint>
                        </pass-through-router>
                    </outbound>
        </service>

Declared
public interface AnotherService {
        public void invoke(String request);
}

In MyServiceImpl.java
I call anotherService.invoke("<soapenv:Envelope...<soapenv:Body>..");

I get the following exception
org.apache.cxf.phase.PhaseInterceptorChain doIntercept
INFO: Application has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=http://example.com/test.asmx,
connector=HttpConnector{this=49764b, started=true, initialised=true, name='connector.http.0', disposed=false, numberOfConcurrentTransactedReceivers=4, createMultipleTransactedReceivers=true, connected=true, supportedProtocols=[http], serviceOverrides=null},
transformer=[ObjectToHttpClientMethodRequest{this=1180cbd, name='ObjectToHttpMethod', ignoreBadInput=false, returnClass=interface org.apache.commons.httpclient.HttpMethod, sourceTypes=[interface org.mule.api.MuleMessage, class [B, class java.lang.String, class java.io.InputStream, interface org.mule.api.transport.OutputHandler, class org.mule.transport.NullPayload]}],
name='endpoint.http.example.com.test.asmx', properties={}, transactionConfig=Transaction{factory=null, action=NEVER, timeout=0}, filter=null, deleteUnacceptedMessages=false, securityFilter=null, synchronous=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8}.
Message payload is of type: PostMethod
        at org.mule.transport.cxf.MuleInvoker.invoke(MuleInvoker.java:131)


Which I noticed is the same error, if I call "http://localhost:8888/services/anotherservice" from SOAPUI with the following ie. no soap body:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" ><soapenv:Header/></soapenv:Envelope>

As well I am not sure what the signature for invoke should be: If I declare returning a String I get a ClassCastException.
Using return of DepthXMLStreamReader gives me the same result as above.
Thanks

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: component call another web service

by Marco Mascia-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Using tcpmon I was able to determine which parts of the Soap body and SoapAction I was missing.
Thanks.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email