Announcement Announcement Module
Collapse
No announcement yet.
Problem connecting to a Axis 1.6.1 web service Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem connecting to a Axis 1.6.1 web service

    Hi,

    I'm trying to connect to a web service build with Axis 1.6.1. I'm using org.springframework.ws.client.core.WebServiceTempl ate defined like this:
    Code:
    <!-- Web service template client data -->
        <beans:bean id="webServiceTemplate"
            class="org.springframework.ws.client.core.WebServiceTemplate"
            p:marshaller-ref="jaxbMarshaller" p:unmarshaller-ref="jaxbMarshaller"
            p:defaultUri="https://192.168.1.107:8443/epin/services/ServicesWebAccess?wsdl"
            p:messageSender-ref="messageSender">
            <beans:constructor-arg ref="messageFactory" />
        </beans:bean>
    
        <beans:bean id="messageFactory"
            class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory" />
    
        <beans:bean id="jaxbMarshaller"
            class="org.springframework.oxm.jaxb.Jaxb2Marshaller"
            p:contextPath="us.inswitch.epin.webservices"  />
    
        <beans:bean id="messageSender"
            class="org.springframework.ws.transport.http.CommonsHttpMessageSender">
            <beans:property name="credentials">
                <beans:bean class="org.apache.commons.httpclient.UsernamePasswordCredentials">
                    <beans:constructor-arg value="admin"/>
                    <beans:constructor-arg value="XXX"/>
                </beans:bean>
            </beans:property>
        </beans:bean>
    I created the classes with wsimport -d wsdlClases/ -s wsdlJava -verbose -keep ServicesWebAccess.xml and copy them to the project.

    I put this code in the controller of the controller:
    Code:
    ManageAccountPreService manageAccountPreService = new ObjectFactory().createManageAccountPreService();
    DTOManageAccountPreRequest dtoRequest = new DTOManageAccountPreRequest();
    us.webservices.dto.services.request.xsd.ObjectFactory elementObjectFactory = new us.webservices.dto.services.request.xsd.ObjectFactory();
    dtoRequest.setAmount(elementObjectFactory.createDTOManageAccountPreRequestAmount(new BigDecimal(10)));
    dtoRequest.setLanguage(elementObjectFactory.createDTOServiceRequestLanguage("ES"));
    dtoRequest.setLocation(elementObjectFactory.createDTOServiceRequestLocation("localhost"));
    dtoRequest.setSourceAgentId(elementObjectFactory.createDTOManageAccountPreRequestSourceAgentId(0));
    dtoRequest.setTargetAgentId(elementObjectFactory.createDTOManageAccountPreRequestTargetAgentId(200));
    dtoRequest.setUserId(elementObjectFactory.createDTOServiceRequestUserId("admin"));
    dtoRequest.setUserPassword(elementObjectFactory.createDTOServiceRequestUserPassword("1234"));
    dtoRequest.setUtfi(elementObjectFactory.createDTOServiceRequestUtfi("1234"));
    //dtoRequest.setAmount();
    manageAccountPreService.setServiceData(new ObjectFactory().createManageAccountPreServiceServiceData(dtoRequest));
    Object test = webServiceTemplate.marshalSendAndReceive(manageAccountPreService);
    Now I can reach the controller but the something is wrong with the data being send, because on the web service there is a handler that extends AbstractHandler.
    There is done this:
    Code:
    String axisService = msgContext.getAxisService().getName();
    String axisOperation = msgContext.getAxisOperation().getName().toString();
    The request with the WebServiceTemplate sends NULL on the axisOperation. But if I copy the generated XML and send it with SOAP UI it gives a good response.

    The xml that is send is:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
       <SOAP-ENV:Header />
       <SOAP-ENV:Body>
          <ns3:manageAccountPreService xmlns:ns3="http://webservices.epin.us" xmlns:ns2="http://request.services.dto.webservices.epin.us/xsd" xmlns:ns4="http://response.services.dto.webservices.epin.us/xsd" xmlns:ns5="http://denomination.dto.webservices.epin.us/xsd">
             <ns3:serviceData>
                <ns2:language>ES</ns2:language>
                <ns2:location>localhost</ns2:location>
                <ns2:userId>admin</ns2:userId>
                <ns2:userPassword>1234</ns2:userPassword>
                <ns2:utfi>1234</ns2:utfi>
                <ns2:amount>10</ns2:amount>
                <ns2:sourceAgentId>0</ns2:sourceAgentId>
                <ns2:targetAgentId>200</ns2:targetAgentId>
             </ns3:serviceData>
          </ns3:manageAccountPreService>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    The one generated with SOAP UI is:
    Code:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservices.epin.us" xmlns:xsd="http://request.services.dto.webservices.epin.us/xsd">
       <soapenv:Header/>
       <soapenv:Body>
          <web:manageAccountPreService>
             <web:serviceData>
                <xsd:language>EN</xsd:language>
                <xsd:location xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
                <xsd:userId>admin</xsd:userId>
                <xsd:userPassword>1234</xsd:userPassword>
                <xsd:utfi xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
                <xsd:amount>1</xsd:amount>
                <xsd:sourceAgentId>0</xsd:sourceAgentId>
                <xsd:targetAgentId>200</xsd:targetAgentId>
             </web:serviceData>
          </web:manageAccountPreService>
       </soapenv:Body>
    </soapenv:Envelope>
    They are the same, what I'm missing on Spring to make this work?

    Any help will be really appreciated.

    Regards

  • #2
    Sorry for not getting to this sooner.

    We are in the process of moving to StackOverflow for our forums.

    This question is probably a better candidate for StackOverflow, perhaps against the #spring-ws tag.

    If you do post it there, please reply here with the link.

    Thanks

    Comment

    Working...
    X