facebook

Web Service Client that uses JMS

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #267643 Reply

    All,

    I am attempting to create a Web Service Client, where the communication protocol is JMS. The exception I get is the following:

    Exception in thread “main” org.codehaus.xfire.XFireRuntimeException: Could not find transport for binding http://www.tibco.com/namespaces/ws/2004/soap/binding/JMS
    at org.codehaus.xfire.client.XFireProxyFactory.create(XFireProxyFactory.java:141)
    at com.circuitcity.myecplise.AsyncWebServiceClient.getEndpoint(AsyncWebServiceClient.java:56)
    at com.circuitcity.myecplise.AsyncWebServiceClient.getEndpoint(AsyncWebServiceClient.java:68)
    at com.circuitcity.myecplise.AsyncWebServiceClient.getAsyncWebServiceJMSPort(AsyncWebServiceClient.java:107)
    at com.circuitcity.myecplise.AsyncWebServiceClient.main(AsyncWebServiceClient.java:135)

    Here is the WSDL source:

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <!–Created by TIBCO WSDL–>
    <wsdl:definitions xmlns:wsdl=”http://schemas.xmlsoap.org/wsdl/ <http://schemas.xmlsoap.org/wsdl/&gt; ” xmlns:tns=”http://xmlns.example.com/1172758360539/AsyncOperationImpl <http://xmlns.example.com/1172758360539/AsyncOperationImpl&gt; ” xmlns:soap=”http://schemas.xmlsoap.org/wsdl/soap/ <http://schemas.xmlsoap.org/wsdl/soap/&gt; ” xmlns:jms=”http://www.tibco.com/namespaces/ws/2004/soap/binding/JMS <http://www.tibco.com/namespaces/ws/2004/soap/binding/JMS&gt; ” xmlns:jndi=”http://www.tibco.com/namespaces/ws/2004/soap/apis/jndi <http://www.tibco.com/namespaces/ws/2004/soap/apis/jndi&gt; ” xmlns:ns0=”http://www.circuitcity.com/uploadDemo <http://www.circuitcity.com/uploadDemo&gt; ” name=”Untitled” targetNamespace=”http://xmlns.example.com/1172758360539/AsyncOperationImpl <http://xmlns.example.com/1172758360539/AsyncOperationImpl&gt; “>
    <wsdl:types>
    <xs:schema xmlns=”http://www.circuitcity.com/uploadDemo <http://www.circuitcity.com/uploadDemo&gt; ” xmlns:xs=”http://www.w3.org/2001/XMLSchema <http://www.w3.org/2001/XMLSchema&gt; ” xmlns:attach=”http://ws-i.org/profiles/basic/1.1/xsd <http://ws-i.org/profiles/basic/1.1/xsd&gt; ” targetNamespace=”http://www.circuitcity.com/uploadDemo <http://www.circuitcity.com/uploadDemo&gt; ” elementFormDefault=”qualified” attributeFormDefault=”unqualified”>
    <xs:element name=”additionalCharge”>
    <xs:complexType>
    <xs:sequence>
    <xs:element ref=”ns0:code” minOccurs=”0″/>
    <xs:element ref=”ns0:cost” minOccurs=”0″/>
    <xs:element ref=”ns0:extendedCost” minOccurs=”0″/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    <xs:element name=”brand” type=”xs:string”/>
    <xs:element name=”cmCost”>
    <xs:simpleType>
    <xs:restriction base=”xs:decimal”>
    <xs:totalDigits value=”11″/>
    <xs:fractionDigits value=”2″/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name=”cmDate” type=”xs:string”/>
    <xs:element name=”cmExtCost”>
    <xs:simpleType>
    <xs:restriction base=”xs:decimal”>
    <xs:totalDigits value=”11″/>
    <xs:fractionDigits value=”2″/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name=”cmNumber” type=”xs:string”/>
    <xs:element name=”cmQuantity” type=”xs:decimal”/>
    <xs:element name=”code” type=”xs:string”/>
    <xs:element name=”cost”>
    <xs:simpleType>
    <xs:restriction base=”xs:decimal”>
    <xs:totalDigits value=”11″/>
    <xs:fractionDigits value=”2″/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name=”defTag” type=”xs:string”/>
    <xs:element name=”extendedCost”>
    <xs:simpleType>
    <xs:restriction base=”xs:decimal”>
    <xs:totalDigits value=”11″/>
    <xs:fractionDigits value=”2″/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name=”fileName” type=”xs:string”/>
    <xs:element name=”model” type=”xs:string”/>
    <xs:element name=”qtyReasonCode” type=”xs:string”/>
    <xs:element name=”row”>
    <xs:complexType>
    <xs:sequence>
    <xs:element ref=”ns0:vendorNumber” minOccurs=”0″/>
    <xs:element ref=”ns0:rtvNumber” minOccurs=”0″/>
    <xs:element ref=”ns0:brand” minOccurs=”0″/>
    <xs:element ref=”ns0:model” minOccurs=”0″/>
    <xs:element ref=”ns0:rtvQuantity” minOccurs=”0″/>
    <xs:element ref=”ns0:rtvCost” minOccurs=”0″/>
    <xs:element ref=”ns0:rtvExtCost” minOccurs=”0″/>
    <xs:element ref=”ns0:cmNumber” minOccurs=”0″/>
    <xs:element ref=”ns0:cmDate” minOccurs=”0″/>
    <xs:element ref=”ns0:cmQuantity” minOccurs=”0″/>
    <xs:element ref=”ns0:cmCost” minOccurs=”0″/>
    <xs:element ref=”ns0:cmExtCost” minOccurs=”0″/>
    <xs:element ref=”ns0:unitOverShort” minOccurs=”0″/>
    <xs:element ref=”ns0:qtyReasonCode” minOccurs=”0″/>
    <xs:element ref=”ns0:defTag” minOccurs=”0″/>
    <xs:element ref=”ns0:additionalCharge” minOccurs=”0″ maxOccurs=”unbounded”/>
    </xs:sequence>
    <xs:attribute name=”number” type=”xs:integer”/>
    </xs:complexType>
    </xs:element>
    <xs:element name=”rtvCost”>
    <xs:simpleType>
    <xs:restriction base=”xs:decimal”>
    <xs:totalDigits value=”11″/>
    <xs:fractionDigits value=”2″/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name=”rtvExtCost”>
    <xs:simpleType>
    <xs:restriction base=”xs:decimal”>
    <xs:totalDigits value=”11″/>
    <xs:fractionDigits value=”2″/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name=”rtvNumber”>
    <xs:simpleType>
    <xs:restriction base=”xs:decimal”>
    <xs:totalDigits value=”11″/>
    <xs:fractionDigits value=”2″/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name=”rtvQuantity” type=”xs:decimal”/>
    <xs:element name=”unitOverShort” type=”xs:decimal”/>
    <xs:element name=”vendorNumber” type=”xs:string”/>
    <xs:element name=”workbook”>
    <xs:complexType>
    <xs:sequence>
    <xs:element ref=”ns0:row” minOccurs=”0″ maxOccurs=”unbounded”/>
    </xs:sequence>
    <xs:attribute name=”name” type=”xs:string”/>
    </xs:complexType>
    </xs:element>
    </xs:schema>
    </wsdl:types>
    <wsdl:message name=”FileInputMessage”>
    <wsdl:part name=”fileName” element=”ns0:fileName”/>
    </wsdl:message>
    <wsdl:portType name=”UploadInterface”>
    <wsdl:operation name=”AsyncOperation”>
    <wsdl:input message=”tns:FileInputMessage”/>
    </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name=”AsyncWebServiceBinding” type=”tns:UploadInterface”>
    <soap:binding style=”document” transport=”http://www.tibco.com/namespaces/ws/2004/soap/binding/JMS”/ <http://www.tibco.com/namespaces/ws/2004/soap/binding/JMS”/&gt; >
    <jms:binding messageFormat=”bytes”/>
    <wsdl:operation name=”AsyncOperation”>
    <wsdl:documentation>The operation has no documentation</wsdl:documentation>
    <soap:operation style=”document” soapAction=”/Automation/AsyncWebService”/>
    <wsdl:input>
    <soap:body use=”literal” namespace=”http://InputMessageNamespace <http://InputMessageNamespace&gt; ” parts=”fileName”/>
    </wsdl:input>
    </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name=”AsyncWebService”>
    <wsdl:port name=”AsyncWebServiceJMSPort” binding=”tns:AsyncWebServiceBinding”>
    <soap:address location=””/>
    <jms:connectionFactory>QueueConnectionFactory</jms:connectionFactory>
    <jms:targetAddress destination=”queue”>RTVCRMS</jms:targetAddress>
    </wsdl:port>
    </wsdl:service>
    </wsdl:definitions>

    Is there a way to make this work?

    Ron

    #267711 Reply

    Riyad Kalla
    Member

    Moving to OT > Soft Dev

    #267729 Reply

    tomeksz
    Member

    Its only guess ( i’ve never used JMS ) but maybe you try to replace http://www.tibco.com/namespaces/ws/2004/soap/binding/JMS with urn:xfire:transport:jms and try client again

    #267750 Reply

    I tried that and I got a similar error:

    Exception in thread “main” org.codehaus.xfire.XFireRuntimeException: Could not find transport for binding urn:xfire:transport:jms
    at org.codehaus.xfire.client.XFireProxyFactory.create(XFireProxyFactory.java:141)
    at com.circuitcity.myecplise.AsyncWebServiceClient.getEndpoint(AsyncWebServiceClient.java:56)
    at com.circuitcity.myecplise.AsyncWebServiceClient.getEndpoint(AsyncWebServiceClient.java:68)
    at com.circuitcity.myecplise.AsyncWebServiceClient.getAsyncWebServiceJMSPort(AsyncWebServiceClient.java:107)
    at com.circuitcity.myecplise.AsyncWebServiceClient.main(AsyncWebServiceClient.java:135)

    #267790 Reply

    tomeksz
    Member

    can you post your client code ?

    #267795 Reply

    Here you go, please note that this is generated via the built-in MyEcplise pliging and directly from the WSDL:

    package com.circuitcity.myecplise;

    import java.net.MalformedURLException;
    import java.util.Collection;
    import java.util.HashMap;
    import javax.xml.namespace.QName;
    import org.codehaus.xfire.XFireRuntimeException;
    import org.codehaus.xfire.aegis.AegisBindingProvider;
    import org.codehaus.xfire.annotations.AnnotationServiceFactory;
    import org.codehaus.xfire.annotations.jsr181.Jsr181WebAnnotations;
    import org.codehaus.xfire.client.XFireProxyFactory;
    import org.codehaus.xfire.jaxb2.JaxbTypeRegistry;
    import org.codehaus.xfire.service.Endpoint;
    import org.codehaus.xfire.service.Service;
    import org.codehaus.xfire.soap.AbstractSoapBinding;
    import org.codehaus.xfire.transport.TransportManager;

    public class AsyncWebServiceClient {

    private static XFireProxyFactory proxyFactory = new XFireProxyFactory();

    private HashMap endpoints = new HashMap();

    private Service service0;

    public AsyncWebServiceClient() {
    create0();
    Endpoint AsyncWebServiceJMSPortEP = service0.addEndpoint(new QName(
    http://xmlns.example.com/1172758360539/AsyncOperationImpl&#8221;,
    “AsyncWebServiceJMSPort”), new QName(
    http://xmlns.example.com/1172758360539/AsyncOperationImpl&#8221;,
    “AsyncWebServiceBinding”), “”);
    endpoints.put(new QName(
    http://xmlns.example.com/1172758360539/AsyncOperationImpl&#8221;,
    “AsyncWebServiceJMSPort”), AsyncWebServiceJMSPortEP);
    Endpoint UploadInterfaceLocalEndpointEP = service0
    .addEndpoint(
    new QName(
    http://xmlns.example.com/1172758360539/AsyncOperationImpl&#8221;,
    “UploadInterfaceLocalEndpoint”),
    new QName(
    http://xmlns.example.com/1172758360539/AsyncOperationImpl&#8221;,
    “UploadInterfaceLocalBinding”),
    “xfire.local://AsyncWebService”);
    endpoints
    .put(
    new QName(
    http://xmlns.example.com/1172758360539/AsyncOperationImpl&#8221;,
    “UploadInterfaceLocalEndpoint”),
    UploadInterfaceLocalEndpointEP);
    }

    public Object getEndpoint(Endpoint endpoint) {
    try {
    return proxyFactory.create((endpoint).getBinding(), (endpoint)
    .getUrl());
    } catch (MalformedURLException e) {
    throw new XFireRuntimeException(“Invalid URL”, e);
    }
    }

    public Object getEndpoint(QName name) {
    Endpoint endpoint = ((Endpoint) endpoints.get((name)));
    if ((endpoint) == null) {
    throw new IllegalStateException(“No such endpoint!”);
    }
    return getEndpoint((endpoint));
    }

    public Collection getEndpoints() {
    return endpoints.values();
    }

    private void create0() {
    TransportManager tm = (org.codehaus.xfire.XFireFactory.newInstance()
    .getXFire().getTransportManager());
    HashMap props = new HashMap();
    props.put(“annotations.allow.interface”, true);
    AnnotationServiceFactory asf = new AnnotationServiceFactory(
    new Jsr181WebAnnotations(), tm, new AegisBindingProvider(
    new JaxbTypeRegistry()));
    asf.setBindingCreationEnabled(false);
    service0 = asf.create(
    (com.circuitcity.myecplise.UploadInterface.class), props);
    {
    AbstractSoapBinding soapBinding = asf
    .createSoap11Binding(
    service0,
    new QName(
    http://xmlns.example.com/1172758360539/AsyncOperationImpl&#8221;,
    “UploadInterfaceLocalBinding”),
    “urn:xfire:transport:local”);
    }
    {
    AbstractSoapBinding soapBinding = asf
    .createSoap11Binding(
    service0,
    new QName(
    http://xmlns.example.com/1172758360539/AsyncOperationImpl&#8221;,
    “AsyncWebServiceBinding”),
    “urn:xfire:transport:jms”);
    }
    }

    public UploadInterface getAsyncWebServiceJMSPort() {
    return ((UploadInterface) (this).getEndpoint(new QName(
    http://xmlns.example.com/1172758360539/AsyncOperationImpl&#8221;,
    “AsyncWebServiceJMSPort”)));
    }

    public UploadInterface getAsyncWebServiceJMSPort(String url) {
    UploadInterface var = getAsyncWebServiceJMSPort();
    org.codehaus.xfire.client.Client.getInstance(var).setUrl(url);
    return var;
    }

    public UploadInterface getUploadInterfaceLocalEndpoint() {
    return ((UploadInterface) (this).getEndpoint(new QName(
    http://xmlns.example.com/1172758360539/AsyncOperationImpl&#8221;,
    “UploadInterfaceLocalEndpoint”)));
    }

    public UploadInterface getUploadInterfaceLocalEndpoint(String url) {
    UploadInterface var = getUploadInterfaceLocalEndpoint();
    org.codehaus.xfire.client.Client.getInstance(var).setUrl(url);
    return var;
    }

    public static void main(String[] args) {

    AsyncWebServiceClient client = new AsyncWebServiceClient();

    //create a default service endpoint
    UploadInterface service = client.getAsyncWebServiceJMSPort();

    //TODO: Add custom client code here
    //
    //service.yourServiceOperationHere();

    System.out.println(“test client completed”);
    System.exit(0);
    }

    }

    — Interface class

    package com.circuitcity.myecplise;

    import javax.jws.Oneway;
    import javax.jws.WebMethod;
    import javax.jws.WebParam;
    import javax.jws.WebService;
    import javax.jws.soap.SOAPBinding;


    @WebService
    (name = “UploadInterface”, targetNamespace = “http://xmlns.example.com/1172758360539/AsyncOperationImpl&#8221;)
    @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.BARE)
    public interface UploadInterface {

    @WebMethod(operationName = “AsyncOperation”, action = “/Automation/AsyncWebService”)
    @Oneway
    public void asyncOperation(
    @WebParam(name = “fileName”, targetNamespace = “http://www.circuitcity.com/uploadDemo&#8221;)
    String fileName);

    }

    #267796 Reply

    tomeksz
    Member

    Ok, looks like you need to manually register JMS transport

    InitialContext context = new InitialContext(props);
    QueueConnectionFactory qfactory = (QueueConnectionFactory)context.lookup(“MyQueueConnectionFactory”);
    XFire xfire = XFireFactory.newInstance().getXFire();
    JMSTransport transport = (JMSTransport) new JMSTransport(xfire, qfactory);
    xfire.getTransportManager().register(transport);
    ObjectServiceFactory sf = new ObjectServiceFactory(xfire.getTransportManager());
    sf.addSoap11Transport(JMSTransport.BINDING_ID);

    Here is full article : http://datsystems.dnsalias.com/dokuwiki/doku.php?id=xfire

    The article describe dynamic client, but as you see code is very similar to generated.

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: Web Service Client that uses JMS

You must be logged in to post in the forum log in