Announcement Announcement Module
Collapse
No announcement yet.
cannot send soap 1.1 message Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • cannot send soap 1.1 message

    hi, everyone

    i am using webServiceTemplate to send soap message,
    the end point is http://azureva.cloudapp.net/GoodDayAzure.asmx
    (for wsdl http://azureva.cloudapp.net/GoodDayAzure.asmx?WSDL)

    Question 1 :
    why
    Code:
     messageFactory.setSoapVersion(SoapVersion.SOAP_12);
    doesn`t work, i have to specify in the spring config file,
    otherwise, no matter what version i sepcify in the java code, it always turn out to be version 1.1 (when i do it in java code, i will delete the version specification from spring config file)


    Question 2 :
    I got a very wired question, when i try to send soap 1.2 message, it will work fine, and get the respone,

    however when i try to send soap 1.1 message,
    it always say sever can not recogniz soapaction



    Code below was how i send the message

    Code:
    WebServiceTemplate webServiceTemplate = (WebServiceTemplate) context.getBean("webServiceTemplate");
                SaajSoapMessageFactory messageFactory = (SaajSoapMessageFactory) context.getBean("messageFactory");
    
                
                WebServiceMessage message = messageFactory.createWebServiceMessage(
                        new ByteArrayInputStream(MESSAGE.getBytes()));
                log.debug("Out going mesage : ");
                message.writeTo(System.out);
                System.out.println("\n");
    
                long timer = Calendar.getInstance().getTimeInMillis();
                webServiceTemplate.sendSourceAndReceiveToResult(message.getPayloadSource(), message.getPayloadResult());
                timer = Calendar.getInstance().getTimeInMillis() - timer;
                log.debug("In coming mesage : ");
                message.writeTo(System.out);
                System.out.println("\n");
                log.debug("Time consume : " + timer + "\n");
    and my spring file
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:util="http://www.springframework.org/schema/util"
           xmlns:oxm="http://www.springframework.org/schema/oxm"
           xsi:schemaLocation="http://www.springframework.org/schema/beans
                               http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                               http://www.springframework.org/schema/util
                               http://www.springframework.org/schema/util/spring-util-2.0.xsd
                               http://www.springframework.org/schema/oxm
                               http://www.springframework.org/schema/oxm/spring-oxm-1.5.xsd">
    
        <bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
            <property name="soapVersion">
                <util:constant static-field="org.springframework.ws.soap.SoapVersion.SOAP_11"/>
            </property>
        </bean>
    
    
        <bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
            <constructor-arg ref="messageFactory"/>
            <property name="defaultUri" value="http://azureva.cloudapp.net/GoodDayAzure.asmx"/>        
        </bean>
    </beans>


    here is the MESSAGE, pick say good day as example
    Code:
    soap 1.1
    
    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body>
        <SayGoodDay xmlns="http://azureva.org/">
          <yourNamePlz>string</yourNamePlz>
        </SayGoodDay>
      </soap:Body>
    </soap:Envelope>
    
    
    soap 1.2
    
    <?xml version="1.0" encoding="utf-8"?>
    <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
      <soap12:Body>
        <SayGoodDay xmlns="http://azureva.org/">
          <yourNamePlz>string</yourNamePlz>
        </SayGoodDay>
      </soap12:Body>
    </soap12:Envelope>
    Last edited by shrimpy; Mar 7th, 2009, 04:13 AM.
Working...
X