Announcement Announcement Module
Collapse
No announcement yet.
get webservice and invoke it Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • get webservice and invoke it

    this might not be the right place to ask since its proabably because i dont understand how to invoke the webservice right but here i go anyway.

    i want to talk to the amazon webservice

    Code:
       <bean id="isbnService" class="dk.bytenbog.model.service.impl.AmazonISBNServiceImpl">
            <property name="service"><ref="isbnServiceProxy"/></property>
        </bean>
    
        <bean id="isbnServiceProxy" class="org.springframework.remoting.jaxrpc.LocalJaxRpcServiceFactoryBean">
            <property name="wsdlDocumentUrl">
                <value>http&#58;//webservices.amazon.com/AWSECommerceService/UK/AWSECommerceService.wsdl</value>
            </property>
            <property name="namespaceUri"><value>http&#58;//webservices.amazon.com/AWSECommerceService/2004-10-19</value></property>
        <property name="serviceName"><value>AWSECommerceService</value></property>
        </bean>
    
    
    public class AmazonISBNServiceImpl implements ISBNService &#123;
    
        private Service service;
    
       private String targetNamespace = "http&#58;//xml.amazon.com/AWSECommerceService/2004-08-01";
    
        private QName operationName = new QName&#40;targetNamespace, "ItemLookup"&#41;;
    
        public void setService&#40;Service service&#41; &#123;
            this.service = service;
        &#125;
    
        public Book getBook&#40;String isbn&#41; throws ISBNLookupException &#123;
    
            Call call = &#40;Call&#41; this.service.createCall&#40;&#41;;
                 call.setOperationName&#40;operationName&#41;;
                 call.addParameter&#40; "SubscriptionId", service.getServiceName&#40;&#41;, ParameterMode.INOUT &#41;;
                 call.setReturnType&#40; XMLType.XSD_STRING &#41;;
    						 String s = &#40;String &#41;call.invoke&#40; new Object&#91;&#93; &#123;"XXXXXXXX"&#125; &#41;;
    						 
    						 &#125;


    shouldent this just return a string with the SubscriptionId that i send to it


    i get a

    aultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
    faultSubcode:
    faultString: No client transport named &apos;null&apos; found!



    if someone could point me in the right direction it would be verry helpfull.

  • #2
    get webservice and invoke it

    Spring supports JAX-RPC like protocols, but does not implement Webservice protocol. So you something like Axis : http://ws.apache.org/axis/ additionally.

    How to use Axis with Spring, best look at the jpetstore example, which comes which the distribution.

    There look specially at the classes:
    org.springframework.samples.jpetstore.service.clie nt.*

    And the configuration file : clientContext.xml in the client subdirectory.
    To address your requirements - invoking a non - rmi based interface, specially also look at the:
    org.springframework.remoting.jaxrpc.JaxRpcPortProx yFactoryBean class

    Hope that helps
    Christoph Henrici

    Comment

    Working...
    X