You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by markpittsnh <ma...@yahoo.com> on 2006/05/25 22:18:19 UTC

Need help to invoke external web service

Can someone help tell me what I am doing wrong. My service resides locally on
tomcat. See WSDL below. I can successfully access the service using a java
client. I would like to invoke it as part of static slip routing - see
servicemix.xml below. As you can see, I tried invoking using as saaj
component. The service, which adds 2 numbers, requires 2 arguments. I used
the client.html from the soap example as  a mean to pass the request.
However, I am not sure what to pass. 

Thanks and regards,
Mark

servicemix.xml
=========

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:sm="http://servicemix.apache.org/config/1.0" 
xmlns:eip="http://servicemix.apache.org/eip/1.0" 
xmlns:test="http://servicemix.apache.org/demo/">

<sm:container id="jbi" rootDir="./wdir" useMBeanServer="true"
createMBeanServer="true" installationDirPath="./install"
deploymentDirPath="./deploy" dumpStats="true" statsInterval="10"
flowName="seda">
<sm:activationSpecs>
<sm:activationSpec id="httpReceiver" service="test:httpBinding"
endpoint="httpReceiver" destinationService="test:routingSlip">
        <sm:component>
                <bean
class="org.apache.servicemix.components.http.HttpConnector">
                        <property name="host" value="localhost"/>
                        <property name="port" value="8912"/>
                </bean>
        </sm:component>
</sm:activationSpec>
<sm:activationSpec id="servicemix-eip">>
        <sm:component>
                <eip:component>
                        <eip:endpoints>
                                <eip:static-routing-slip
service="test:routingSlip" endpoint="endpoint">
                                        <eip:targets>
                                                <eip:exchange-target
service="foo:addIt" />
                                                <eip:exchange-target
service="test:echo"/>
                                        </eip:targets>
                                </eip:static-routing-slip>
                        </eip:endpoints>
                </eip:component>
        </sm:component>
</sm:activationSpec>
<sm:activationSpec id="echo" service="test:echo" endpoint="endpoint">
        <sm:component>
                <bean
class="org.apache.servicemix.components.util.EchoComponent"/>
        </sm:component>
</sm:activationSpec>

<!-- This just invokes another service -->
<sm:activationSpec componentName="addIt"   
                   service="foo:addIt"
                   endpoint="addIt">
  <sm:component>
    <bean class="org.apache.servicemix.components.saaj.SaajBinding">
          <property name="soapEndpoint">
              <bean class="javax.xml.messaging.URLEndpoint">
                  <constructor-arg
value="http://localhost:8080/jaxws-simpleexample/simplemethod"/>
              </bean>
          </property>
    </bean>
  </sm:component>
</sm:activationSpec>


</sm:activationSpecs>
</sm:container>
</beans>


WSDL
=====

<definitions xmlns:tns="http://server.simpleexample/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="http://server.simpleexample/" name="SimpleJAXWSService">
  <types>
    <xsd:schema>
      <xsd:import namespace="http://server.simpleexample/"
schemaLocation="http://localhost:8080/jaxws-simpleexample/simplemethod?xsd=1"/>
    </xsd:schema>
  </types>
  <message name="simpleMethod">
    <part element="tns:simpleMethod" name="parameters"/>
  </message>
  <message name="simpleMethodResponse">

    <part element="tns:simpleMethodResponse" name="parameters"/>
  </message>
  <message name="SimpleException">
    <part element="tns:SimpleException" name="SimpleException"/>
  </message>
  <portType name="SimpleJAXWS">
    <operation name="simpleMethod">
      <input message="tns:simpleMethod"/>
      <output message="tns:simpleMethodResponse"/>

      <fault message="tns:SimpleException" name="SimpleException"/>
    </operation>
  </portType>
  <binding type="tns:SimpleJAXWS" name="SimpleJAXWSPortBinding">
    <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="simpleMethod">
      <soap:operation soapAction=""/>
      <input>
        <soap:body use="literal"/>

      </input>
      <output>
        <soap:body use="literal"/>
      </output>
      <fault name="SimpleException">
        <soap:fault use="literal" name="SimpleException"/>
      </fault>
    </operation>
  </binding>

  <service name="SimpleJAXWSService">
    <port binding="tns:SimpleJAXWSPortBinding" name="SimpleJAXWSPort">
      <soap:address
location="http://localhost:8080/jaxws-simpleexample/simplemethod"/>
    </port>
  </service>
</definitions>


JAVA service
========

package simpleexample.server;

import javax.jws.WebService;

@WebService
public class SimpleJAXWS {

    /**
     * @param number1
     * @param number2
     * @return quotient
     * @throws SimpleException
     *             If denominator is zero.
     */
    public int simpleMethod(int number1, int number2) throws SimpleException
{
        if ( number2 == 0 ) {
            throw new SimpleException("Cannot divide by zero!",
                "Numbers: " + number1 + ", " + number2);
        }
        return number1 / number2;
    }
}

--
View this message in context: http://www.nabble.com/Need+help+to+invoke+external+web+service-t1683202.html#a4565466
Sent from the ServiceMix - User forum at Nabble.com.


Re: Need help to invoke external web service

Posted by Tomas Olsson <to...@sics.se>.
You can also use http://www.soapui.org/ which LGPL
/Tomas


dajevu wrote:

>For my 2 cents, usually what I do is use a tool such as SOAPScope from
>Mindreef (you can get a 30-day trial copy) and then compare the raw XML it
>produces with what Servicemix generates (I often use TCPMonitor that comes
>with Apache Axis to see exactly what XML is being exchanged).  With
>SOAPScope, you simply load the WSDL for the destination service, and it will
>create a test form for submitting the data.
>
>jeff
>--
>View this message in context: http://www.nabble.com/Need+help+to+invoke+external+web+service-t1683202.html#a4606185
>Sent from the ServiceMix - User forum at Nabble.com.
>  
>


Re: Need help to invoke external web service

Posted by dajevu <jd...@hireright.com>.
For my 2 cents, usually what I do is use a tool such as SOAPScope from
Mindreef (you can get a 30-day trial copy) and then compare the raw XML it
produces with what Servicemix generates (I often use TCPMonitor that comes
with Apache Axis to see exactly what XML is being exchanged).  With
SOAPScope, you simply load the WSDL for the destination service, and it will
create a test form for submitting the data.

jeff
--
View this message in context: http://www.nabble.com/Need+help+to+invoke+external+web+service-t1683202.html#a4606185
Sent from the ServiceMix - User forum at Nabble.com.


Re: Need help to invoke external web service

Posted by Eric Dofonsou <ew...@yahoo.com>.
My guess would be that the "xs:" name space is not
defined in your soap message but that is a wild guess.
 Have you tried running the service directly on the
tomcat web server without going throug servicemix just
to make sure that your web service can  handle the
message ?  Can you run servicemix in debug mode (see
log4j.xml) that way you will have dump of the various
in and out messages provided by the ESB endpoints.

--- markpittsnh <ma...@yahoo.com> wrote:

> 
> Here is the latest payload I am sending to my
> tomcat-hosted web service....
> 
> <?xml version="1.0"?>
> <env:Envelope
>
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
>              
> xmlns:tns="http://servicemix.org/test/">
>     <env:Body>
> <simpleMethod>
>   <tns:parameters>
>   <arg0 type="xs:int">1</arg0>
>   <arg1 type="xs:int">2</arg1>
>   </tns:parameters>
> </simpleMethod>
>     </env:Body>
> </env:Envelope>
> 
> Here is the stack I am seeing in tomcat. Any
> suggestions would be
> appreciated.....
> 
> INFO: Server startup in 6125 ms
> May 26, 2006 9:38:51 AM
>
com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher
> toMessageInfo
> SEVERE: Error in decoding SOAP Message
> Error in decoding SOAP Message
>         at
>
com.sun.xml.ws.encoding.soap.server.SOAPXMLDecoder.toInternalMessage(SOAPXMLDecoder.java:86)
>         at
>
com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.toMessageInfo(SOAPMessageDispatcher.java:168)
>         at
>
com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher$SoapInvoker.invoke(SOAPMessageDispatcher.java:533)
>         at
>
com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.receive(SOAPMessageDispatcher.java:140)
>         at
> com.sun.xml.ws.server.Tie.handle(Tie.java:88)
>         at
>
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.handle(WSServletDelegate.java:279)
>         at
>
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:232)
>         at
>
com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:77)
>         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:869)
>         at
>
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
>         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(Thread.java:595)
> Caused by: javax.xml.ws.soap.SOAPFaultException:
> Cannot find the dispatch
> method
>         at
>
com.sun.xml.ws.encoding.soap.SOAPDecoder.raiseFault(SOAPDecoder.java:662)
>         at
>
com.sun.xml.ws.encoding.soap.server.SOAPXMLDecoder.decodeDispatchMethod(SOAPXMLDecoder.java:151)
>         at
>
com.sun.xml.ws.encoding.soap.SOAPDecoder.decodeBodyContent(SOAPDecoder.java:335)
>         at
>
com.sun.xml.ws.encoding.soap.SOAPDecoder.decodeBody(SOAPDecoder.java:325)
>         at
>
com.sun.xml.ws.encoding.soap.SOAPDecoder.decodeEnvelope(SOAPDecoder.java:248)
>         at
>
com.sun.xml.ws.encoding.soap.server.SOAPXMLDecoder.toInternalMessage(SOAPXMLDecoder.java:78)
>         ... 23 more
> 
> --
> View this message in context:
>
http://www.nabble.com/Need+help+to+invoke+external+web+service-t1683202.html#a4576356
> Sent from the ServiceMix - User forum at Nabble.com.
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: Need help to invoke external web service

Posted by markpittsnh <ma...@yahoo.com>.
Here is the latest payload I am sending to my tomcat-hosted web service....

<?xml version="1.0"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
              xmlns:tns="http://servicemix.org/test/">
    <env:Body>
<simpleMethod>
  <tns:parameters>
  <arg0 type="xs:int">1</arg0>
  <arg1 type="xs:int">2</arg1>
  </tns:parameters>
</simpleMethod>
    </env:Body>
</env:Envelope>

Here is the stack I am seeing in tomcat. Any suggestions would be
appreciated.....

INFO: Server startup in 6125 ms
May 26, 2006 9:38:51 AM
com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher toMessageInfo
SEVERE: Error in decoding SOAP Message
Error in decoding SOAP Message
        at
com.sun.xml.ws.encoding.soap.server.SOAPXMLDecoder.toInternalMessage(SOAPXMLDecoder.java:86)
        at
com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.toMessageInfo(SOAPMessageDispatcher.java:168)
        at
com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher$SoapInvoker.invoke(SOAPMessageDispatcher.java:533)
        at
com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.receive(SOAPMessageDispatcher.java:140)
        at com.sun.xml.ws.server.Tie.handle(Tie.java:88)
        at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.handle(WSServletDelegate.java:279)
        at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:232)
        at
com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:77)
        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:869)
        at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
        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(Thread.java:595)
Caused by: javax.xml.ws.soap.SOAPFaultException: Cannot find the dispatch
method
        at
com.sun.xml.ws.encoding.soap.SOAPDecoder.raiseFault(SOAPDecoder.java:662)
        at
com.sun.xml.ws.encoding.soap.server.SOAPXMLDecoder.decodeDispatchMethod(SOAPXMLDecoder.java:151)
        at
com.sun.xml.ws.encoding.soap.SOAPDecoder.decodeBodyContent(SOAPDecoder.java:335)
        at
com.sun.xml.ws.encoding.soap.SOAPDecoder.decodeBody(SOAPDecoder.java:325)
        at
com.sun.xml.ws.encoding.soap.SOAPDecoder.decodeEnvelope(SOAPDecoder.java:248)
        at
com.sun.xml.ws.encoding.soap.server.SOAPXMLDecoder.toInternalMessage(SOAPXMLDecoder.java:78)
        ... 23 more

--
View this message in context: http://www.nabble.com/Need+help+to+invoke+external+web+service-t1683202.html#a4576356
Sent from the ServiceMix - User forum at Nabble.com.