Announcement Announcement Module
Collapse
No announcement yet.
webservice client using spring integration issue with namespace Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • webservice client using spring integration issue with namespace

    I am trying to do web-service invocation using ws:outbound-gateway using spring integration. I am using JAXB2Marshaller for marshalling the POJO's, I am able to configure the web service invocation but its failing with exception.

    Here is my configuration:


    HTML Code:
    <chain input-channel="inputChannel" output-channel="outputChannel">
            <header-enricher>
                <header name="springintegration_ws_soapAction"
                        value="http://service.webservices.test.com/xsd/"/>
            </header-enricher>
            <ws:outbound-gateway uri="http://localhost:1234/EFormsWebServiceApp/services/EForms" marshaller="jaxbMarshaller" />
        </chain>
    
     <beans:bean id="jaxbMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
            <beans:property name="contextPath" value="com.selfserviceportal.eFormBusinessService.generated"/>
        </beans:bean>
    Here is my client code:

    HTML Code:
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("eFormService.xml");
    
            GetStoreNumber ri = EformServiceMessageTransformer.processGetStoreNumber();
    
            EformServiceGateway gateway = (EformServiceGateway) context.getBean("eFormServiceGateway");
            gateway.sendGetStoreNumberMessage(ri);
    when I use tcpmon and monitor the request message looks like below:

    HTML Code:
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
    <getStoreNumber xmlns:ns3="http://service.webservices.test.com/xsd">
    <param>
    <clientName>SoapSpringClient</clientName>
    <clientServerVersionNumber>1.0</clientServerVersionNumber>
    <messageId>502-78-1234</messageId>
    <sequenceNumber>1</sequenceNumber>
    <storeNumber>1992</storeNumber></param0>
    </getStoreNumber>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    In the above "getStoreNumber" is my web service method:

    Its failing with below exception:

    HTML Code:
    Caused by: org.springframework.ws.soap.client.SoapFaultClientException: Cannot find dispatch method for {}getStoreNumber
    	at org.springframework.ws.soap.client.core.SoapFaultMessageResolver.resolveFault(SoapFaultMessageResolver.java:37)
    	at org.springframework.ws.client.core.WebServiceTemplate.handleFault(WebServiceTemplate.java:735)
    	at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:563)
    	at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:501)
    I know the reason it is failing when I edit my request message by adding ns3: before getStoreNumber then I am getting response back.

    How to force JAXB to add namespace before method name?

    Please let me know. thanks.

  • #2
    Did anyone know anything about this issue?

    Did anyone know anything about this issue?

    Comment


    • #3
      Is "getStoreNumber" a complex type or an element in your XML schema ?

      If it is only a complex type, try adding an element with the complex type "getStoreNumber" and passing to the JAXBMarshaller an instance of JAXBElement<GetStoreNumber> (see ObjectFactory methods) instead of an instance of GetStoreNumber.

      I'm not sure if this will work, but that's how I handle it.

      Comment


      • #4
        Thank You for your reply.

        Hi,

        Thanks for your reply, I tried that just before seeing your message, it worked. greatly. I am just pasting what I changed here for anyones use:


        HTML Code:
        ObjectFactory aObj = new ObjectFactory();
                JAXBElement<GetStoreNumber> element = aObj.createGetStoreNumber(getStoreNumber);
                gateway.sendJaxbElement(element);
        Thanks,
        Sri

        Comment

        Working...
        X