Announcement Announcement Module
Collapse
No announcement yet.
spring-ws 2.0, SAOPAction empty, HTTP header POST / Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • spring-ws 2.0, SAOPAction empty, HTTP header POST /

    Hello,
    i need to consume wcf web service. https + wsse (username token, password plain text).

    On call i get (wcf) exception :
    The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).

    Then i was switch from https to http and use tcpmon to observe communication between my client and service. I also use soapui and capture its successfully communication with service. SOAP envelope (header + body) look almost the same. I notice difference in HTTP header
    1) HTTP field POST point to / (root) instead of real service location (/SecuredTHD/THDwcf.svc)
    2) HTTP field SOAPAction is empty, can i define it in application-context.xml or from code?

    Any tip?

    Thanks,
    Neven.


    my client:
    Code:
    POST / HTTP/1.1
    Accept-Encoding: gzip
    Accept: text/xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
    SOAPAction: ""
    Content-Type: text/xml; charset=utf-8
    Content-Length: 861
    Cache-Control: no-cache
    Pragma: no-cache
    User-Agent: Java/1.6.0_21
    Host: computer.network.some
    Connection: keep-alive

    soapui header:
    Code:
    POST /SecuredTHD/THDwcf.svc HTTP/1.1
    Accept-Encoding: gzip,deflate
    Content-Type: text/xml;charset=UTF-8
    SOAPAction: "some/THDwcf/Ithd/getTxnHistory"
    User-Agent: Jakarta Commons-HttpClient/3.1
    Host: computer.network.some
    Content-Length: 804


    application-context.xml:
    Code:
    ...
    	<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory" />
    
    	<bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
    		<constructor-arg ref="messageFactory" />
    		<property name="defaultUri" value="https://computer.network.some/SecuredTHD/THDwcf.svc" />
    		<property name="interceptors">
    			<list>
    				<ref local="wss4jSecurityInterceptor" />
    			</list>
    		</property>
    	</bean>
    
    
    	<bean id="wss4jSecurityInterceptor"
    		class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
    
    		<property name="securementActions" value="UsernameToken" />
    		<property name="validationActions" value="" />
    
    		<property name="securementPasswordType" value="PasswordText" />
    		<property name="securementUsername" value="username" />
    		<property name="securementPassword" value="password" />
    		<property name="securementMustUnderstand" value="false" />
    
    	</bean>
    
    ...
    WebServiceClient.java:
    Code:
    	public void simpleSendAndReceive() {
    		StreamSource source = new StreamSource(new StringReader(MESSAGE));
    		StreamResult result = new StreamResult(System.out);
    		webServiceTemplate.sendSourceAndReceiveToResult(source, result);
    	}
    Last edited by nevenr; Feb 5th, 2011, 08:29 AM.

  • #2
    I found solution. In this reference i found how to specify SAOPAction and it seems to me that HTTP header POST is not important for this case. My HTML header looks like:
    Code:
    POST / HTTP/1.1
    Accept-Encoding: gzip
    Accept: text/xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
    SOAPAction: "some/THDwcf/Ithd/getTxnHistory"
    Content-Type: text/xml; charset=utf-8
    Content-Length: 861
    Cache-Control: no-cache
    Pragma: no-cache
    User-Agent: Java/1.6.0_21
    Host: computer.network.some
    Connection: keep-alive

    Comment

    Working...
    X