question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hello,

I was wondering if wiremock supports https SOAP web services. The examples all seem to me to indicate a path needs to be unique. In my case every request is a POST to the same end point like:

https://myserver.com:443/sdk

Where the payloads being sent would be unique, and the responses coming back would be unique. If this is possible would you mind showing me a simple example?

Thanks

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:8
  • Comments:17

github_iconTop GitHub Comments

3reactions
rafendencommented, Apr 20, 2017

That’s how I configured it to work with Soap calls.

/mappings/SayHello.json

{
  "request": {
    "method": "POST",
    "url": "/mocked-soap-service.wsdl",
    "headers" : {
      "SOAPAction" : {
        "contains" : "#SayHello"
      }
    }
  },
  "response": {
    "status": 200,
    "bodyFileName": "SayHello.xml",
    "headers": {
      "Content-Type": "application/xml"
    }
  }
}

/files/SayHello.xml

<?xml version="1.0"?>

<soap:Envelope
        xmlns:soap="http://www.w3.org/2003/05/soap-envelope/"
        soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
    ...
    Message information goes here
    ...
</soap:Envelope>

Executing request in PHP

<?php
$params = array(
  'location' => 'http://localhost:8080/mocked-soap-service.wsdl',
  'uri' => 'http://localhost:8080/mocked-soap-service.wsdl',
);

$client = new SoapClient(null, $params);
var_dump($client->__soapCall("SayHello", array("SomeKindOfID" => 1234)));
2reactions
tomakehurstcommented, Aug 27, 2014

In principle it’s possible to mock SOAP responses, using request body matching (full XML or XPath) to differentiate.

e.g.

stubFor(post(urlEqualTo("/sdk"))
    .withRequestBody(matchingXPath("/packages[count(package) = 3]"))
    .willReturn(aResponse()
        .withStatus(200)
        .withBody("<soap ....>"));
Read more comments on GitHub >

github_iconTop Results From Across the Web

SOAP - Wikipedia
SOAP is a messaging protocol specification for exchanging structured information in the implementation of web services in computer networks.
Read more >
SOAP (Simple Object Access Protocol) - TechTarget
SOAP is a lightweight protocol used to create web APIs, usually with Extensible Markup Language (XML). It supports a wide range of communication...
Read more >
SOAP Web Services Tutorial: What is SOAP Protocol ... - Guru99
SOAP is an XML-based protocol for accessing web services over HTTP. It has some specification which could be used across all applications. SOAP...
Read more >
What is SOAP API: Formats, Protocols, and Architecture
SOAP works with XML only · SOAP message structure · SOAP extensibility with WS standard protocols · ACID compliance · Web Service Description ......
Read more >
SOAP vs REST. What's the Difference? - SmartBear
SOAP is designed to support expansion, so it has all sorts of other acronyms and abbreviations associated with it, such as WS-Addressing, WS-Policy, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found