Results 1 to 5 of 5

Thread: Body is not added in Soap request

  1. #1
    Join Date
    Apr 2009
    Posts
    17

    Unhappy Body is not added in Soap request

    Hi,

    I am using jaxb to generate the stub, after generating the stub, i am creating a soap request, but input is not getting added to the soap request.

    Code:
    WebServiceTemplate wsTemplate = getWebServiceTemplate();
    		ObjectFactory objectFactory = new ObjectFactory();
    
    		GetCustomerBalance request = objectFactory.createGetCustomerBalance();
    		request.setAccountNumber(accNo);
    
    		GetCustomerBalanceResponse response = null;
    		response = (GetCustomerBalanceResponse) wsTemplate.marshalSendAndReceive(request, 
    				new SoapActionCallback("http://test.com/CommunicationChannels/getCustomerBalance"));
    the request goes like

    Code:
    <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'><env:Header></env:Header><env:Body><ns2:getCustomerBalance xmlns:ns2='http://test.com/CommunicationChannels'/></env:Body></env:Envelope>
    Am I doing wrong some where?

    Please let me know what is the issue in this soap request.

    Thanks in Advance
    Sri

  2. #2
    Join Date
    Jun 2009
    Posts
    16

    Default

    I recently had a similar problem when sending a response to the client. The solution was to use another message factory.

    Code:
    <bean id="messageFactory" class="org.springframework.ws.soap.axiom.AxiomSoapMessageFactory">
        <property name="payloadCaching" value="true" />
    </bean>
    
    <bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
        <constructor-arg ref="messageFactory"/>
        <property name="defaultUri" value="http://example.com/WebService"/>
    </bean>
    Maybe this solves your problem as well.

  3. #3
    Join Date
    Apr 2009
    Posts
    17

    Red face Body is not added in Soap request

    Hi,

    I changed the configuration, even the content is not getting added.

    Attached code snippet.

    Code:
    <bean id="wsMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
        	<property name="contextPath" value="com.air2web.projects.csm.schema" />
        </bean>
         <bean id="wsmessageFactory"
     	class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory" />
     	
     	
    	 <bean id="wsMessageSender" class="org.springframework.ws.transport.http.CommonsHttpMessageSender" />
    
    	<bean id="wsClient" class="com.projects.csm.WSClient">
    		<description> WebService client</description>
    		<property name="defaultUri" value="${webService.uri}" />
    		<property name="marshaller" ref="wsMarshaller" />
    		<property name="unmarshaller" ref="wsMarshaller" />
    		<property name="messageSender" ref="wsMessageSender" />
    		<property name="messageFactory" ref="wsmessageFactory" />
    	</bean>
    	
    	<bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
    	    <property name="messageFactory" ref="wsmessageFactory" />
    	   	<property name="messageSender" ref="wsMessageSender" />
    	</bean>
    Please let me know, if the configuration is wrong.

    Thanks in Advance
    Sri

  4. #4
    Join Date
    Jun 2009
    Posts
    16

    Default

    Have you tried using a different message factory and/or marshaller?

  5. #5
    Join Date
    Apr 2009
    Posts
    17

    Default Body is not added in Soap request

    I used different messagefactory, but not differenet marshallers.

    Because I have only wsdl, I dont have xsd or xml. If I am going to use xmlbeanmarshaller, I need to have xsd, which i dont have.

    Let me know if you could able to find some solutions.

    I have created one more thread for xmlbeanmarshaller
    XMLBeanMarshaller Invalid property 'classesToBeBound'

    ObjectFactory objectFactory = new ObjectFactory();



    GetCustomerBalance request = objectFactory.createGetCustomerBalance();
    request.setAccountNumber(accNo);

    GetCustomerBalanceResponse response = null;

    response = (GetCustomerBalanceResponse) wsTemplate.marshalSendAndReceive(request,
    new WebServiceMessageCallback() {
    @SuppressWarnings("unchecked")
    public void doWithMessage(WebServiceMessage message) {
    ((SoapMessage) message).setSoapAction("http://test.com/CommunicationChannels/getCustomerBalance");
    }
    });
    The account number is not getting added in the request

    [QUOTE<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'><env:Header></env:Header><env:Body><ns2:getCustomerBalance xmlns:ns2='http://test.com/CommunicationChannels'/></env:Body></env:Envelope>[/QUOTE]

    Thanks in Advance
    Sri

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •