Results 1 to 3 of 3

Thread: Integration Testing of secure Spring Web Service

  1. #1
    Join Date
    Feb 2012
    Location
    Des Moines, IA
    Posts
    6

    Question Integration Testing of secure Spring Web Service

    I am trying to write server side integration tests of my Spring Web Service Endpoint secured using - Spring WS Security 2.1.2.RELEASE and - WSS4j 1.6.9. I am trying to follow Spring documentation http://static.springsource.org/sprin...ml/server.html. With the setup that I have got so far, I can send a request payload

    Code:
    <myns:MyRequest xmlns:myns="...">
            ...
    </myns:MyRequest>
    using MockWebServiceClient as
    Code:
    mockWebServiceClient.sendRequest(withPayload(requestPayload)).andExpect(clientOrSenderFault());
    which the integration test properly maps to the endpoint in the test context and I get a "Could not validate request: No WS-Security header found" error as expected.

    Problem: Now the problem here is if I send a request in a SOAP envelope with a security header and body, I would get an endpoint not found exception.
    Code:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:myns="...">
       <soapenv:Header>
           ...
       </soapenv:Header>
       <soapenv:Body>
          <myns:MyRequest>
            ...
          </myns:MyRequest>
       </soapenv:Body>
    </soapenv:Envelope>
    since it will try to find an endpoint around "{http://schemas.xmlsoap.org/soap/envelope/}Envelope".

    Is there a way to work around this problem?
    Lal Sah

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,695

    Default

    Have you looked at the javadocs of RequestCreators? Instead of withPayload use withSoapEnveloppe.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Feb 2012
    Location
    Des Moines, IA
    Posts
    6

    Default

    That's what I was expecting but since I was using spring-ws-test-2.0.5.RELEASE, I didn't have that. I got that with upgrade to spring-ws-test-2.1.2.RELEASE.
    Thanks Marten for pointing that out.

Tags for this Thread

Posting Permissions

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