SoapClient large refactoring & tests update
This commit is contained in:
@ -12,7 +12,8 @@
|
||||
|
||||
namespace BeSimple\SoapClient\Tests;
|
||||
|
||||
use BeSimple\SoapClient\Curl;
|
||||
use BeSimple\SoapClient\Curl\Curl;
|
||||
use BeSimple\SoapClient\Curl\CurlOptionsBuilder;
|
||||
|
||||
/**
|
||||
* @author Andreas Schamberger <mail@andreass.net>
|
||||
@ -21,11 +22,12 @@ class CurlTest extends AbstractWebserverTest
|
||||
{
|
||||
public function testExec()
|
||||
{
|
||||
$curl = new Curl(array(
|
||||
'proxy_host' => false,
|
||||
));
|
||||
$curlOptions = CurlOptionsBuilder::buildDefault();
|
||||
$curl = new Curl(
|
||||
$curlOptions
|
||||
);
|
||||
|
||||
$this->assertTrue($curl->exec(sprintf('http://localhost:%d/curl.txt', WEBSERVER_PORT)));
|
||||
$this->assertTrue($curl->executeCurl($curlOptions, sprintf('http://localhost:%d/curl.txt', WEBSERVER_PORT)));
|
||||
$this->assertTrue($curl->exec(sprintf('http://localhost:%d/404.txt', WEBSERVER_PORT)));
|
||||
}
|
||||
|
||||
@ -81,43 +83,4 @@ class CurlTest extends AbstractWebserverTest
|
||||
$curl->exec(sprintf('http://localhost:%d/curl.txt', WEBSERVER_PORT));
|
||||
$this->assertEquals('This is a testfile for cURL.', $curl->getResponseBody());
|
||||
}
|
||||
|
||||
public function testGetResponseContentType()
|
||||
{
|
||||
$curl = new Curl(array(
|
||||
'proxy_host' => false,
|
||||
));
|
||||
|
||||
$curl->exec(sprintf('http://localhost:%d/curl.txt', WEBSERVER_PORT));
|
||||
$this->assertEquals('text/plain; charset=UTF-8', $curl->getResponseContentType());
|
||||
|
||||
$curl->exec(sprintf('http://localhost:%d/404.txt', WEBSERVER_PORT));
|
||||
$this->assertEquals('text/html; charset=UTF-8', $curl->getResponseContentType());
|
||||
}
|
||||
|
||||
public function testGetResponseHeaders()
|
||||
{
|
||||
$curl = new Curl(array(
|
||||
'proxy_host' => false,
|
||||
));
|
||||
|
||||
$curl->exec(sprintf('http://localhost:%d/curl.txt', WEBSERVER_PORT));
|
||||
$this->assertEquals(117 + self::$websererPortLength, strlen($curl->getResponseHeaders()));
|
||||
|
||||
$curl->exec(sprintf('http://localhost:%d/404.txt', WEBSERVER_PORT));
|
||||
$this->assertEquals(124 + self::$websererPortLength, strlen($curl->getResponseHeaders()));
|
||||
}
|
||||
|
||||
public function testGetResponseStatusCode()
|
||||
{
|
||||
$curl = new Curl(array(
|
||||
'proxy_host' => false,
|
||||
));
|
||||
|
||||
$curl->exec(sprintf('http://localhost:%d/curl.txt', WEBSERVER_PORT));
|
||||
$this->assertEquals(200, $curl->getResponseStatusCode());
|
||||
|
||||
$curl->exec(sprintf('http://localhost:%d/404.txt', WEBSERVER_PORT));
|
||||
$this->assertEquals(404, $curl->getResponseStatusCode());
|
||||
}
|
||||
}
|
||||
|
8
src/BeSimple/SoapClient/Tests/GenerateTestRequest.php
Normal file
8
src/BeSimple/SoapClient/Tests/GenerateTestRequest.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace BeSimple\SoapClient\Tests;
|
||||
|
||||
class GenerateTestRequest
|
||||
{
|
||||
public $salutation;
|
||||
}
|
8
src/BeSimple/SoapClient/Tests/GetUKLocationByCounty.php
Normal file
8
src/BeSimple/SoapClient/Tests/GetUKLocationByCounty.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace BeSimple\SoapClient\Tests;
|
||||
|
||||
class GetUKLocationByCounty
|
||||
{
|
||||
public $County;
|
||||
}
|
23
src/BeSimple/SoapClient/Tests/Mock/.readme
Normal file
23
src/BeSimple/SoapClient/Tests/Mock/.readme
Normal file
@ -0,0 +1,23 @@
|
||||
# HOW TO PREPARE Mock SWA Service
|
||||
|
||||
1. Create an test endpoint by using tools such as mockable.io, that will return response (expect POST requests with SOAP v1.1)
|
||||
similar to the one provided in example file src/BeSimple/SoapClient/Tests/Mock/MockSwaService.example.response
|
||||
and Content-Type headers from src/BeSimple/SoapClient/Tests/Mock/MockSwaService.example.response.headers
|
||||
|
||||
Example Endpoint URL: https://demo0580999.mockable.io/soap/testGenerator
|
||||
|
||||
2. Create a test WSDL endpoint that will return WSDL file from (expect GET requests)
|
||||
an example file src/BeSimple/SoapClient/Tests/Mock/MockSwaService.wsdl
|
||||
|
||||
Example WSDL endpoint URL: https://demo0580999.mockable.io/soap/testGenerator?WSDL
|
||||
|
||||
3. Take the two endpoints and configure SoapClientBuilderTest::TEST_ENDPOINT_SWA
|
||||
and SoapClientBuilderTest::TEST_REMOTE_WSDL_SWA variables
|
||||
|
||||
4. The test BeSimple\SoapClient\Tests\SoapClientBuilderTest::testSoapCallSwaWithAttachmentsOnResponse should work correctly.
|
||||
|
||||
If not, try to catch SoapFaultWithTracingData thrown by the soapCall method:
|
||||
|
||||
$soapClient->soapCall('generateTest', [$generateTestRequest]);
|
||||
|
||||
You can print the SoapFaultWithTracingData attributes in order to investigate the SoapClient request and request headers.
|
@ -0,0 +1,18 @@
|
||||
|
||||
--Part_13_58a1b01a466a6.58a1b01a466e8
|
||||
Content-Type: application/soap+xml; charset=utf-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Content-ID: <part-72f5d209-2631-42ee-81d1-e554af739ce6@response.info>
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://schema.testcase"><env:Body xmlns:rpc="http://www.w3.org/2003/05/soap-rpc"><ns1:generateTestResponse><rpc:result>generateTestReturn</rpc:result><generateTestReturn><fileName>dummy-attachment.txt</fileName></generateTestReturn></ns1:generateTestResponse></env:Body></env:Envelope>
|
||||
|
||||
--Part_13_58a1b01a466a6.58a1b01a466e8
|
||||
Content-Type: text/plain; charset=utf-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Content-ID: <dummy-attachment.txt>
|
||||
Content-Location: dummy-attachment.txt
|
||||
|
||||
Hello world!
|
||||
|
||||
--Part_13_58a1b01a466a6.58a1b01a466e8--
|
@ -0,0 +1 @@
|
||||
multipart/related; type="application/soap+xml"; charset=utf-8; boundary=Part_13_58a1b01a466a6.58a1b01a466e8; start="<part-72f5d209-2631-42ee-81d1-e554af739ce6@response.info>"
|
61
src/BeSimple/SoapClient/Tests/Mock/MockSwaService.wsdl
Normal file
61
src/BeSimple/SoapClient/Tests/Mock/MockSwaService.wsdl
Normal file
@ -0,0 +1,61 @@
|
||||
<?xml version="1.0"?>
|
||||
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://schema.testcase" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://schema.testcase">
|
||||
<wsdl:types>
|
||||
<xsd:schema targetNamespace="http://schema.testcase">
|
||||
<xsd:complexType name="SoapHeaderEntity">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="user" type="xsd:string" minOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>User name for authorization</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:element name="SoapHeader" type="tns:SoapHeaderEntity"/>
|
||||
<xsd:complexType name="GenerateTestRequest">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="salutation" type="xsd:string" minOccurs="0"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="GenerateTestResponse">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="fileName" type="xsd:string" minOccurs="1"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:schema>
|
||||
</wsdl:types>
|
||||
<message name="SoapHeader">
|
||||
<part name="SoapHeader" element="tns:SoapHeader"/>
|
||||
</message>
|
||||
<message name="GenerateTestRequest">
|
||||
<part name="request" type="tns:GenerateTestRequest"/>
|
||||
</message>
|
||||
<message name="GenerateTestResponse">
|
||||
<part name="generateTestReturn" type="tns:GenerateTestResponse"/>
|
||||
</message>
|
||||
<wsdl:portType name="TestGeneratorServiceSoapPortType">
|
||||
<wsdl:operation name="generateTest">
|
||||
<wsdl:input message="tns:GenerateTestRequest"/>
|
||||
<wsdl:output message="tns:GenerateTestResponse"/>
|
||||
</wsdl:operation>
|
||||
</wsdl:portType>
|
||||
<binding name="TestGeneratorServiceSoapBinding" type="tns:TestGeneratorServiceSoapPortType">
|
||||
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
|
||||
<wsdl:operation name="generateTest">
|
||||
<soap:operation soapAction="TestGeneratorService.generateTest" style="rpc"/>
|
||||
<wsdl:input>
|
||||
<soap:header use="literal" message="tns:SoapHeader" part="SoapHeader" namespace="http://schema.testcase"/>
|
||||
<soap:body use="literal" part="request" namespace="http://schema.testcase"/>
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap:body use="literal" namespace="http://schema.testcase"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
</binding>
|
||||
<wsdl:service name="TestGeneratorService">
|
||||
<xsd:documentation>WSDL file for TestGeneratorService</xsd:documentation>
|
||||
<port name="TestGeneratorServiceSoapPortType" binding="tns:TestGeneratorServiceSoapBinding">
|
||||
<soap:address location="https://demo0580999.mockable.io/soap/testGenerator"/>
|
||||
</port>
|
||||
</wsdl:service>
|
||||
</wsdl:definitions>
|
@ -12,113 +12,286 @@
|
||||
|
||||
namespace BeSimple\SoapClient\Tests;
|
||||
|
||||
use BeSimple\SoapBundle\Soap\SoapAttachment;
|
||||
use BeSimple\SoapClient\Curl\CurlOptions;
|
||||
use BeSimple\SoapClient\SoapClientBuilder;
|
||||
use BeSimple\SoapClient\SoapClientOptionsBuilder;
|
||||
use BeSimple\SoapClient\SoapFaultWithTracingData;
|
||||
use BeSimple\SoapClient\SoapOptions\SoapClientOptions;
|
||||
use BeSimple\SoapCommon\ClassMap;
|
||||
use BeSimple\SoapCommon\SoapOptions\SoapOptions;
|
||||
use BeSimple\SoapCommon\SoapOptionsBuilder;
|
||||
use Exception;
|
||||
use SoapHeader;
|
||||
|
||||
class SoapClientBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
private $defaultOptions = array(
|
||||
'features' => 0,
|
||||
'classmap' => array(),
|
||||
'typemap' => array(),
|
||||
);
|
||||
const CACHE_DIR = __DIR__ . '/../../../../cache';
|
||||
const TEST_ENDPOINT_UK = 'http://www.webservicex.net/uklocation.asmx';
|
||||
const TEST_REMOTE_WSDL_UK = 'http://www.webservicex.net/uklocation.asmx?WSDL';
|
||||
const TEST_LOCAL_WSDL_UK = __DIR__.'/localWsdl.wsdl';
|
||||
const TEST_REMOTE_WSDL_NOT_WORKING = 'http://www.nosuchserverexist.tld/doesnotexist.endpoint?wsdl';
|
||||
const TEST_ENDPOINT_SWA = 'https://demo2815480.mockable.io/soap/testGenerator';
|
||||
const TEST_REMOTE_WSDL_SWA = 'https://demo2815480.mockable.io/soap/testGenerator?WSDL';
|
||||
|
||||
public function testContruct()
|
||||
public function testSoapOptionsCreateWithDefaults()
|
||||
{
|
||||
$options = $this
|
||||
->getSoapBuilder()
|
||||
->getSoapOptions()
|
||||
;
|
||||
$defaultOptions = SoapOptionsBuilder::createWithDefaults(self::TEST_LOCAL_WSDL_UK);
|
||||
|
||||
$this->assertEquals($this->mergeOptions(array()), $options);
|
||||
self::assertInstanceOf(SoapOptions::class, $defaultOptions);
|
||||
self::assertEquals(self::TEST_LOCAL_WSDL_UK, $defaultOptions->getWsdlFile());
|
||||
}
|
||||
|
||||
public function testWithTrace()
|
||||
public function testSoapClientOptionsCreateWithDefaults()
|
||||
{
|
||||
$builder = $this->getSoapBuilder();
|
||||
$defaultOptions = SoapClientOptionsBuilder::createWithDefaults();
|
||||
|
||||
$builder->withTrace();
|
||||
$this->assertEquals($this->mergeOptions(array('trace' => true)), $builder->getSoapOptions());
|
||||
|
||||
$builder->withTrace(false);
|
||||
$this->assertEquals($this->mergeOptions(array('trace' => false)), $builder->getSoapOptions());
|
||||
self::assertInstanceOf(SoapClientOptions::class, $defaultOptions);
|
||||
self::assertEquals(CurlOptions::DEFAULT_USER_AGENT, $defaultOptions->getUserAgent());
|
||||
}
|
||||
|
||||
public function testWithExceptions()
|
||||
public function testConstructSoapClientWithDefaults()
|
||||
{
|
||||
$builder = $this->getSoapBuilder();
|
||||
$soapClient = $this->getSoapBuilder()->build(
|
||||
SoapClientOptionsBuilder::createWithDefaults(),
|
||||
SoapOptionsBuilder::createWithDefaults(self::TEST_REMOTE_WSDL_UK)
|
||||
);
|
||||
|
||||
$builder->withExceptions();
|
||||
$this->assertEquals($this->mergeOptions(array('exceptions' => true)), $builder->getSoapOptions());
|
||||
|
||||
$builder->withExceptions(false);
|
||||
$this->assertEquals($this->mergeOptions(array('exceptions' => false)), $builder->getSoapOptions());
|
||||
self::assertInstanceOf(\SoapClient::class, $soapClient);
|
||||
}
|
||||
|
||||
public function testWithUserAgent()
|
||||
public function testConstructSoapClientWithSwaAndClassMapAndCacheDisk()
|
||||
{
|
||||
$builder = $this->getSoapBuilder();
|
||||
$soapOptions = SoapOptionsBuilder::createSwaWithClassMap(
|
||||
self::TEST_REMOTE_WSDL_UK,
|
||||
new ClassMap(),
|
||||
SoapOptions::SOAP_CACHE_TYPE_DISK,
|
||||
__DIR__.'/../../../../cache'
|
||||
);
|
||||
|
||||
$builder->withUserAgent('BeSimpleSoap Test');
|
||||
$this->assertEquals($this->mergeOptions(array('user_agent' => 'BeSimpleSoap Test')), $builder->getSoapOptions());
|
||||
$soapClient = $this->getSoapBuilder()->build(
|
||||
SoapClientOptionsBuilder::createWithDefaults(),
|
||||
$soapOptions
|
||||
);
|
||||
|
||||
self::assertInstanceOf(\SoapClient::class, $soapClient);
|
||||
}
|
||||
|
||||
public function testWithCompression()
|
||||
public function testConstructSoapClientWithDefaultsAndLocalWsdlFile()
|
||||
{
|
||||
$builder = $this->getSoapBuilder();
|
||||
$soapClient = $this->getSoapBuilder()->build(
|
||||
SoapClientOptionsBuilder::createWithDefaults(),
|
||||
SoapOptionsBuilder::createWithDefaults(self::TEST_LOCAL_WSDL_UK)
|
||||
);
|
||||
|
||||
$builder->withCompressionGzip();
|
||||
$this->assertEquals($this->mergeOptions(array('compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP)), $builder->getSoapOptions());
|
||||
|
||||
$builder->withCompressionDeflate();
|
||||
$this->assertEquals($this->mergeOptions(array('compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_DEFLATE)), $builder->getSoapOptions());
|
||||
self::assertInstanceOf(\SoapClient::class, $soapClient);
|
||||
}
|
||||
|
||||
public function testWithAuthentication()
|
||||
public function testConstructSoapClientWithSwaAndClassMapAndCacheDiskAndLocalWsdlFile()
|
||||
{
|
||||
$builder = $this->getSoapBuilder();
|
||||
$soapOptions = SoapOptionsBuilder::createSwaWithClassMap(
|
||||
self::TEST_LOCAL_WSDL_UK,
|
||||
new ClassMap(),
|
||||
SoapOptions::SOAP_CACHE_TYPE_DISK,
|
||||
__DIR__ .'/../../../../cache'
|
||||
);
|
||||
|
||||
$builder->withDigestAuthentication(__DIR__.'/Fixtures/cert.pem', 'foobar');
|
||||
$this->assertEquals($this->mergeOptions(array('authentication' => SOAP_AUTHENTICATION_DIGEST, 'local_cert' => __DIR__.'/Fixtures/cert.pem', 'passphrase' => 'foobar')), $builder->getSoapOptions());
|
||||
$soapClient = $this->getSoapBuilder()->build(
|
||||
SoapClientOptionsBuilder::createWithDefaults(),
|
||||
$soapOptions
|
||||
);
|
||||
|
||||
$builder->withDigestAuthentication(__DIR__.'/Fixtures/cert.pem');
|
||||
$this->assertEquals($this->mergeOptions(array('authentication' => SOAP_AUTHENTICATION_DIGEST, 'local_cert' => __DIR__.'/Fixtures/cert.pem')), $builder->getSoapOptions());
|
||||
|
||||
$builder->withBasicAuthentication('foo', 'bar');
|
||||
$this->assertEquals($this->mergeOptions(array('authentication' => SOAP_AUTHENTICATION_BASIC, 'login' => 'foo', 'password' => 'bar')), $builder->getSoapOptions());
|
||||
self::assertInstanceOf(\SoapClient::class, $soapClient);
|
||||
}
|
||||
|
||||
public function testWithProxy()
|
||||
public function testSoapCall()
|
||||
{
|
||||
$builder = $this->getSoapBuilder();
|
||||
$soapClient = $this->getSoapBuilder()->build(
|
||||
SoapClientOptionsBuilder::createWithDefaults(),
|
||||
SoapOptionsBuilder::createWithDefaults(self::TEST_REMOTE_WSDL_UK)
|
||||
);
|
||||
$getUKLocationByCountyRequest = new GetUKLocationByCounty();
|
||||
$getUKLocationByCountyRequest->County = 'London';
|
||||
$soapResponse = $soapClient->soapCall('GetUKLocationByCounty', [$getUKLocationByCountyRequest]);
|
||||
|
||||
$builder->withProxy('localhost', 8080);
|
||||
$this->assertEquals($this->mergeOptions(array('proxy_host' => 'localhost', 'proxy_port' => 8080)), $builder->getSoapOptions());
|
||||
self::assertContains('GetUKLocationByCountyResult', $soapResponse->getContent());
|
||||
self::assertContains('</GetUKLocationByCountyResponse>', $soapResponse->getContent());
|
||||
self::assertEquals(self::TEST_ENDPOINT_UK, $soapResponse->getLocation());
|
||||
}
|
||||
|
||||
$builder->withProxy('127.0.0.1', 8585, 'foo', 'bar');
|
||||
$this->assertEquals($this->mergeOptions(array('proxy_host' => '127.0.0.1', 'proxy_port' => 8585, 'proxy_login' => 'foo', 'proxy_password' => 'bar')), $builder->getSoapOptions());
|
||||
public function testSoapCallWithCacheEndpointDownShouldFail()
|
||||
{
|
||||
$this->setExpectedException(Exception::class, 'Could not write WSDL cache file: Download failed with message');
|
||||
|
||||
$builder->withProxy('127.0.0.1', 8585, 'foo', 'bar', \CURLAUTH_BASIC);
|
||||
$this->assertEquals($this->mergeOptions(array('proxy_host' => '127.0.0.1', 'proxy_port' => 8585, 'proxy_login' => 'foo', 'proxy_password' => 'bar', 'proxy_auth' => \CURLAUTH_BASIC)), $builder->getSoapOptions());
|
||||
$this->getSoapBuilder()->build(
|
||||
SoapClientOptionsBuilder::createWithDefaults(),
|
||||
SoapOptionsBuilder::createWithDefaults(
|
||||
self::TEST_REMOTE_WSDL_NOT_WORKING,
|
||||
SoapOptions::SOAP_CACHE_TYPE_DISK,
|
||||
__DIR__ .'/../../../../cache'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$builder->withProxy('127.0.0.1', 8585, 'foo', 'bar', \CURLAUTH_NTLM);
|
||||
$this->assertEquals($this->mergeOptions(array('proxy_host' => '127.0.0.1', 'proxy_port' => 8585, 'proxy_login' => 'foo', 'proxy_password' => 'bar', 'proxy_auth' => \CURLAUTH_NTLM)), $builder->getSoapOptions());
|
||||
public function testSoapCallEndpointDownShouldFail()
|
||||
{
|
||||
$this->setExpectedException(Exception::class, 'Parsing WSDL: Couldn\'t load from');
|
||||
|
||||
$this->getSoapBuilder()->build(
|
||||
SoapClientOptionsBuilder::createWithDefaults(),
|
||||
SoapOptionsBuilder::createWithDefaults(self::TEST_REMOTE_WSDL_NOT_WORKING)
|
||||
);
|
||||
}
|
||||
|
||||
public function testSoapCallNoSwaWithAttachmentMustFail()
|
||||
{
|
||||
$this->setExpectedException(Exception::class, 'Non SWA SoapClient cannot handle SOAP action');
|
||||
|
||||
$soapClient = $this->getSoapBuilder()->build(
|
||||
SoapClientOptionsBuilder::createWithDefaults(),
|
||||
SoapOptionsBuilder::createWithDefaults(self::TEST_REMOTE_WSDL_UK)
|
||||
);
|
||||
$getUKLocationByCountyRequest = new GetUKLocationByCounty();
|
||||
$getUKLocationByCountyRequest->County = 'London';
|
||||
|
||||
$soapClient->soapCall(
|
||||
'GetUKLocationByCounty',
|
||||
[$getUKLocationByCountyRequest],
|
||||
[
|
||||
new SoapAttachment(
|
||||
'first-file.txt',
|
||||
'text/plain',
|
||||
'unexpected file - no SWA - must fail'
|
||||
),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function testSoapCallSwaWithTwoAttachments()
|
||||
{
|
||||
$soapClient = $this->getSoapBuilder()->build(
|
||||
SoapClientOptionsBuilder::createWithTracing(),
|
||||
SoapOptionsBuilder::createSwaWithClassMap(
|
||||
self::TEST_REMOTE_WSDL_UK,
|
||||
new ClassMap(),
|
||||
SoapOptions::SOAP_CACHE_TYPE_DISK,
|
||||
__DIR__ .'/../../../../cache'
|
||||
)
|
||||
);
|
||||
$getUKLocationByCountyRequest = new GetUKLocationByCounty();
|
||||
$getUKLocationByCountyRequest->County = 'London';
|
||||
|
||||
try {
|
||||
$builder->withProxy('127.0.0.1', 8585, 'foo', 'bar', -100);
|
||||
|
||||
$this->fail('An expected exception has not been raised.');
|
||||
} catch (\Exception $e) {
|
||||
$this->assertInstanceOf('InvalidArgumentException', $e);
|
||||
$soapResponse = $soapClient->soapCall(
|
||||
'GetUKLocationByCounty',
|
||||
[$getUKLocationByCountyRequest],
|
||||
[
|
||||
new SoapAttachment(
|
||||
'first-file.txt',
|
||||
'text/plain',
|
||||
'hello world'
|
||||
),
|
||||
new SoapAttachment(
|
||||
'second-file.txt',
|
||||
'text/plain',
|
||||
'hello world'
|
||||
)
|
||||
]
|
||||
);
|
||||
$tracingData = $soapResponse->getTracingData();
|
||||
} catch (SoapFaultWithTracingData $e) {
|
||||
$tracingData = $e->getSoapResponseTracingData();
|
||||
}
|
||||
|
||||
self::assertEquals(
|
||||
$this->getContentId($tracingData->getLastRequestHeaders()),
|
||||
$this->getContentId($tracingData->getLastRequest()),
|
||||
'Content ID must match in request XML and Content-Type: ...; start header'
|
||||
);
|
||||
self::assertEquals(
|
||||
$this->getMultiPartBoundary($tracingData->getLastRequestHeaders()),
|
||||
$this->getMultiPartBoundary($tracingData->getLastRequest()),
|
||||
'MultiPart boundary must match in request XML and Content-Type: ...; boundary header'
|
||||
);
|
||||
self::assertContains('boundary=Part_', $tracingData->getLastRequestHeaders(), 'Headers should link to boundary');
|
||||
self::assertContains('start="<part-', $tracingData->getLastRequestHeaders(), 'Headers should link to first MultiPart');
|
||||
self::assertContains('action="', $tracingData->getLastRequestHeaders(), 'Headers should contain SOAP action');
|
||||
self::assertEquals(
|
||||
$this->removeOneTimeData(file_get_contents(__DIR__.'/soapRequestWithTwoAttachments.request')),
|
||||
$this->removeOneTimeData($tracingData->getLastRequest()),
|
||||
'Requests must match after onetime data were removed'
|
||||
);
|
||||
}
|
||||
|
||||
public function testCreateWithDefaults()
|
||||
public function testSoapCallSwaWithNoAttachments()
|
||||
{
|
||||
$builder = SoapClientBuilder::createClientWithDefaults();
|
||||
$soapClient = $this->getSoapBuilder()->build(
|
||||
SoapClientOptionsBuilder::createWithTracing(),
|
||||
SoapOptionsBuilder::createSwaWithClassMap(
|
||||
self::TEST_REMOTE_WSDL_UK,
|
||||
new ClassMap(),
|
||||
SoapOptions::SOAP_CACHE_TYPE_DISK,
|
||||
__DIR__ .'/../../../../cache'
|
||||
)
|
||||
);
|
||||
$getUKLocationByCountyRequest = new GetUKLocationByCounty();
|
||||
$getUKLocationByCountyRequest->County = 'London';
|
||||
|
||||
$this->assertInstanceOf('BeSimple\SoapClient\SoapClientBuilder', $builder);
|
||||
try {
|
||||
$soapResponse = $soapClient->soapCall(
|
||||
'GetUKLocationByCounty',
|
||||
[$getUKLocationByCountyRequest]
|
||||
);
|
||||
$tracingData = $soapResponse->getTracingData();
|
||||
} catch (SoapFaultWithTracingData $e) {
|
||||
$tracingData = $e->getSoapResponseTracingData();
|
||||
}
|
||||
|
||||
$this->assertEquals($this->mergeOptions(array('soap_version' => SOAP_1_2, 'encoding' => 'UTF-8', 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, 'user_agent' => 'BeSimpleSoap')), $builder->getSoapOptions());
|
||||
self::assertNotContains('boundary=Part_', $tracingData->getLastRequestHeaders(), 'Headers should link to boundary');
|
||||
self::assertNotContains('start="<part-', $tracingData->getLastRequestHeaders(), 'Headers should link to first MultiPart');
|
||||
self::assertContains('action="', $tracingData->getLastRequestHeaders(), 'Headers should contain SOAP action');
|
||||
self::assertEquals(
|
||||
file_get_contents(__DIR__.'/soapRequestWithNoAttachments.request'),
|
||||
$tracingData->getLastRequest(),
|
||||
'Requests must match'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see This test needs a working SWA endpoint. Examine Tests/Mock directory for details
|
||||
*/
|
||||
public function testSoapCallSwaWithAttachmentsOnResponse()
|
||||
{
|
||||
$soapClient = $this->getSoapBuilder()->buildWithSoapHeader(
|
||||
SoapClientOptionsBuilder::createWithTracing(),
|
||||
SoapOptionsBuilder::createSwaWithClassMapV11(
|
||||
self::TEST_REMOTE_WSDL_SWA,
|
||||
new ClassMap([
|
||||
'GenerateTestRequest' => GenerateTestRequest::class,
|
||||
]),
|
||||
SoapOptions::SOAP_CACHE_TYPE_DISK,
|
||||
__DIR__ . '/../../../../cache'
|
||||
),
|
||||
new SoapHeader('http://schema.testcase', 'SoapHeader', [
|
||||
'user' => 'admin',
|
||||
])
|
||||
);
|
||||
$generateTestRequest = new GenerateTestRequest();
|
||||
$generateTestRequest->salutation = 'World';
|
||||
|
||||
$soapResponse = $soapClient->soapCall('generateTest', [$generateTestRequest]);
|
||||
$attachments = $soapResponse->getAttachments();
|
||||
|
||||
self::assertContains('</generateTestReturn>', $soapResponse->getResponseContent());
|
||||
self::assertTrue($soapResponse->hasAttachments());
|
||||
self::assertCount(1, $attachments);
|
||||
|
||||
$firstAttachment = reset($attachments);
|
||||
|
||||
self::assertEquals('text/plain', $firstAttachment->getHeader('Content-Type'));
|
||||
|
||||
file_put_contents(self::CACHE_DIR . '/testSoapCallSwaWithAttachmentsOnResponse.xml', $soapResponse->getContent());
|
||||
file_put_contents(self::CACHE_DIR . '/testSoapCallSwaWithAttachmentsOnResponse.txt', $firstAttachment->getContent());
|
||||
}
|
||||
|
||||
private function getSoapBuilder()
|
||||
@ -126,8 +299,41 @@ class SoapClientBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
return new SoapClientBuilder();
|
||||
}
|
||||
|
||||
private function mergeOptions(array $options)
|
||||
public function removeOneTimeData($string)
|
||||
{
|
||||
return array_merge($this->defaultOptions, $options);
|
||||
$contentId = $this->getContentId($string);
|
||||
$multiPartBoundary = $this->getMultiPartBoundary($string);
|
||||
|
||||
return str_replace(
|
||||
$contentId,
|
||||
'{content-id-placeholder}',
|
||||
str_replace(
|
||||
$multiPartBoundary,
|
||||
'{multipart-boundary-placeholder}',
|
||||
$string
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private function getMultiPartBoundary($string)
|
||||
{
|
||||
$realMultiParts = null;
|
||||
preg_match('/Part\_[0-9]{2}\_[a-zA-Z0-9]{13}\.[a-zA-Z0-9]{13}/', $string, $realMultiParts);
|
||||
if (count($realMultiParts) > 0) {
|
||||
return $realMultiParts[0];
|
||||
}
|
||||
|
||||
throw new Exception('Could not find real MultiPart boundary');
|
||||
}
|
||||
|
||||
private function getContentId($string)
|
||||
{
|
||||
$realContentIds = null;
|
||||
preg_match('/part\-[0-9a-f]{8}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{12}\@response\.info/', $string, $realContentIds);
|
||||
if (count($realContentIds) > 0) {
|
||||
return $realContentIds[0];
|
||||
}
|
||||
|
||||
throw new Exception('Could not find real contentId');
|
||||
}
|
||||
}
|
||||
|
380
src/BeSimple/SoapClient/Tests/localWsdl.wsdl
Normal file
380
src/BeSimple/SoapClient/Tests/localWsdl.wsdl
Normal file
@ -0,0 +1,380 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<wsdl:definitions xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://www.webserviceX.NET" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://www.webserviceX.NET" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
|
||||
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get UK Postcode,Town,County and Validate UK Address</wsdl:documentation>
|
||||
<wsdl:types>
|
||||
<s:schema elementFormDefault="qualified" targetNamespace="http://www.webserviceX.NET">
|
||||
<s:element name="GetUKLocationByCounty">
|
||||
<s:complexType>
|
||||
<s:sequence>
|
||||
<s:element minOccurs="0" maxOccurs="1" name="County" type="s:string" />
|
||||
</s:sequence>
|
||||
</s:complexType>
|
||||
</s:element>
|
||||
<s:element name="GetUKLocationByCountyResponse">
|
||||
<s:complexType>
|
||||
<s:sequence>
|
||||
<s:element minOccurs="0" maxOccurs="1" name="GetUKLocationByCountyResult" type="s:string" />
|
||||
</s:sequence>
|
||||
</s:complexType>
|
||||
</s:element>
|
||||
<s:element name="GetUKLocationByTown">
|
||||
<s:complexType>
|
||||
<s:sequence>
|
||||
<s:element minOccurs="0" maxOccurs="1" name="Town" type="s:string" />
|
||||
</s:sequence>
|
||||
</s:complexType>
|
||||
</s:element>
|
||||
<s:element name="GetUKLocationByTownResponse">
|
||||
<s:complexType>
|
||||
<s:sequence>
|
||||
<s:element minOccurs="0" maxOccurs="1" name="GetUKLocationByTownResult" type="s:string" />
|
||||
</s:sequence>
|
||||
</s:complexType>
|
||||
</s:element>
|
||||
<s:element name="GetUKLocationByPostCode">
|
||||
<s:complexType>
|
||||
<s:sequence>
|
||||
<s:element minOccurs="0" maxOccurs="1" name="PostCode" type="s:string" />
|
||||
</s:sequence>
|
||||
</s:complexType>
|
||||
</s:element>
|
||||
<s:element name="GetUKLocationByPostCodeResponse">
|
||||
<s:complexType>
|
||||
<s:sequence>
|
||||
<s:element minOccurs="0" maxOccurs="1" name="GetUKLocationByPostCodeResult" type="s:string" />
|
||||
</s:sequence>
|
||||
</s:complexType>
|
||||
</s:element>
|
||||
<s:element name="ValidateUKAddress">
|
||||
<s:complexType>
|
||||
<s:sequence>
|
||||
<s:element minOccurs="0" maxOccurs="1" name="Town" type="s:string" />
|
||||
<s:element minOccurs="0" maxOccurs="1" name="County" type="s:string" />
|
||||
<s:element minOccurs="0" maxOccurs="1" name="PostCode" type="s:string" />
|
||||
</s:sequence>
|
||||
</s:complexType>
|
||||
</s:element>
|
||||
<s:element name="ValidateUKAddressResponse">
|
||||
<s:complexType>
|
||||
<s:sequence>
|
||||
<s:element minOccurs="0" maxOccurs="1" name="ValidateUKAddressResult" type="s:string" />
|
||||
</s:sequence>
|
||||
</s:complexType>
|
||||
</s:element>
|
||||
<s:element name="string" nillable="true" type="s:string" />
|
||||
</s:schema>
|
||||
</wsdl:types>
|
||||
<wsdl:message name="GetUKLocationByCountySoapIn">
|
||||
<wsdl:part name="parameters" element="tns:GetUKLocationByCounty" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="GetUKLocationByCountySoapOut">
|
||||
<wsdl:part name="parameters" element="tns:GetUKLocationByCountyResponse" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="GetUKLocationByTownSoapIn">
|
||||
<wsdl:part name="parameters" element="tns:GetUKLocationByTown" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="GetUKLocationByTownSoapOut">
|
||||
<wsdl:part name="parameters" element="tns:GetUKLocationByTownResponse" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="GetUKLocationByPostCodeSoapIn">
|
||||
<wsdl:part name="parameters" element="tns:GetUKLocationByPostCode" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="GetUKLocationByPostCodeSoapOut">
|
||||
<wsdl:part name="parameters" element="tns:GetUKLocationByPostCodeResponse" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="ValidateUKAddressSoapIn">
|
||||
<wsdl:part name="parameters" element="tns:ValidateUKAddress" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="ValidateUKAddressSoapOut">
|
||||
<wsdl:part name="parameters" element="tns:ValidateUKAddressResponse" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="GetUKLocationByCountyHttpGetIn">
|
||||
<wsdl:part name="County" type="s:string" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="GetUKLocationByCountyHttpGetOut">
|
||||
<wsdl:part name="Body" element="tns:string" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="GetUKLocationByTownHttpGetIn">
|
||||
<wsdl:part name="Town" type="s:string" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="GetUKLocationByTownHttpGetOut">
|
||||
<wsdl:part name="Body" element="tns:string" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="GetUKLocationByPostCodeHttpGetIn">
|
||||
<wsdl:part name="PostCode" type="s:string" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="GetUKLocationByPostCodeHttpGetOut">
|
||||
<wsdl:part name="Body" element="tns:string" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="ValidateUKAddressHttpGetIn">
|
||||
<wsdl:part name="Town" type="s:string" />
|
||||
<wsdl:part name="County" type="s:string" />
|
||||
<wsdl:part name="PostCode" type="s:string" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="ValidateUKAddressHttpGetOut">
|
||||
<wsdl:part name="Body" element="tns:string" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="GetUKLocationByCountyHttpPostIn">
|
||||
<wsdl:part name="County" type="s:string" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="GetUKLocationByCountyHttpPostOut">
|
||||
<wsdl:part name="Body" element="tns:string" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="GetUKLocationByTownHttpPostIn">
|
||||
<wsdl:part name="Town" type="s:string" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="GetUKLocationByTownHttpPostOut">
|
||||
<wsdl:part name="Body" element="tns:string" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="GetUKLocationByPostCodeHttpPostIn">
|
||||
<wsdl:part name="PostCode" type="s:string" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="GetUKLocationByPostCodeHttpPostOut">
|
||||
<wsdl:part name="Body" element="tns:string" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="ValidateUKAddressHttpPostIn">
|
||||
<wsdl:part name="Town" type="s:string" />
|
||||
<wsdl:part name="County" type="s:string" />
|
||||
<wsdl:part name="PostCode" type="s:string" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="ValidateUKAddressHttpPostOut">
|
||||
<wsdl:part name="Body" element="tns:string" />
|
||||
</wsdl:message>
|
||||
<wsdl:portType name="UKLocationSoap">
|
||||
<wsdl:operation name="GetUKLocationByCounty">
|
||||
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get UK town,Postcode and County by full /partial County</wsdl:documentation>
|
||||
<wsdl:input message="tns:GetUKLocationByCountySoapIn" />
|
||||
<wsdl:output message="tns:GetUKLocationByCountySoapOut" />
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="GetUKLocationByTown">
|
||||
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get UK town,Postcode and County by full /partial Town</wsdl:documentation>
|
||||
<wsdl:input message="tns:GetUKLocationByTownSoapIn" />
|
||||
<wsdl:output message="tns:GetUKLocationByTownSoapOut" />
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="GetUKLocationByPostCode">
|
||||
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get UK town,Postcode and County by Postcode(First Section of Post Code)</wsdl:documentation>
|
||||
<wsdl:input message="tns:GetUKLocationByPostCodeSoapIn" />
|
||||
<wsdl:output message="tns:GetUKLocationByPostCodeSoapOut" />
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="ValidateUKAddress">
|
||||
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Validate UK address,Use First Section of Poscode for Postcode atribute</wsdl:documentation>
|
||||
<wsdl:input message="tns:ValidateUKAddressSoapIn" />
|
||||
<wsdl:output message="tns:ValidateUKAddressSoapOut" />
|
||||
</wsdl:operation>
|
||||
</wsdl:portType>
|
||||
<wsdl:portType name="UKLocationHttpGet">
|
||||
<wsdl:operation name="GetUKLocationByCounty">
|
||||
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get UK town,Postcode and County by full /partial County</wsdl:documentation>
|
||||
<wsdl:input message="tns:GetUKLocationByCountyHttpGetIn" />
|
||||
<wsdl:output message="tns:GetUKLocationByCountyHttpGetOut" />
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="GetUKLocationByTown">
|
||||
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get UK town,Postcode and County by full /partial Town</wsdl:documentation>
|
||||
<wsdl:input message="tns:GetUKLocationByTownHttpGetIn" />
|
||||
<wsdl:output message="tns:GetUKLocationByTownHttpGetOut" />
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="GetUKLocationByPostCode">
|
||||
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get UK town,Postcode and County by Postcode(First Section of Post Code)</wsdl:documentation>
|
||||
<wsdl:input message="tns:GetUKLocationByPostCodeHttpGetIn" />
|
||||
<wsdl:output message="tns:GetUKLocationByPostCodeHttpGetOut" />
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="ValidateUKAddress">
|
||||
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Validate UK address,Use First Section of Poscode for Postcode atribute</wsdl:documentation>
|
||||
<wsdl:input message="tns:ValidateUKAddressHttpGetIn" />
|
||||
<wsdl:output message="tns:ValidateUKAddressHttpGetOut" />
|
||||
</wsdl:operation>
|
||||
</wsdl:portType>
|
||||
<wsdl:portType name="UKLocationHttpPost">
|
||||
<wsdl:operation name="GetUKLocationByCounty">
|
||||
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get UK town,Postcode and County by full /partial County</wsdl:documentation>
|
||||
<wsdl:input message="tns:GetUKLocationByCountyHttpPostIn" />
|
||||
<wsdl:output message="tns:GetUKLocationByCountyHttpPostOut" />
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="GetUKLocationByTown">
|
||||
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get UK town,Postcode and County by full /partial Town</wsdl:documentation>
|
||||
<wsdl:input message="tns:GetUKLocationByTownHttpPostIn" />
|
||||
<wsdl:output message="tns:GetUKLocationByTownHttpPostOut" />
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="GetUKLocationByPostCode">
|
||||
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get UK town,Postcode and County by Postcode(First Section of Post Code)</wsdl:documentation>
|
||||
<wsdl:input message="tns:GetUKLocationByPostCodeHttpPostIn" />
|
||||
<wsdl:output message="tns:GetUKLocationByPostCodeHttpPostOut" />
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="ValidateUKAddress">
|
||||
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Validate UK address,Use First Section of Poscode for Postcode atribute</wsdl:documentation>
|
||||
<wsdl:input message="tns:ValidateUKAddressHttpPostIn" />
|
||||
<wsdl:output message="tns:ValidateUKAddressHttpPostOut" />
|
||||
</wsdl:operation>
|
||||
</wsdl:portType>
|
||||
<wsdl:binding name="UKLocationSoap" type="tns:UKLocationSoap">
|
||||
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
|
||||
<wsdl:operation name="GetUKLocationByCounty">
|
||||
<soap:operation soapAction="http://www.webserviceX.NET/GetUKLocationByCounty" style="document" />
|
||||
<wsdl:input>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="GetUKLocationByTown">
|
||||
<soap:operation soapAction="http://www.webserviceX.NET/GetUKLocationByTown" style="document" />
|
||||
<wsdl:input>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="GetUKLocationByPostCode">
|
||||
<soap:operation soapAction="http://www.webserviceX.NET/GetUKLocationByPostCode" style="document" />
|
||||
<wsdl:input>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="ValidateUKAddress">
|
||||
<soap:operation soapAction="http://www.webserviceX.NET/ValidateUKAddress" style="document" />
|
||||
<wsdl:input>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
</wsdl:binding>
|
||||
<wsdl:binding name="UKLocationSoap12" type="tns:UKLocationSoap">
|
||||
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
|
||||
<wsdl:operation name="GetUKLocationByCounty">
|
||||
<soap12:operation soapAction="http://www.webserviceX.NET/GetUKLocationByCounty" style="document" />
|
||||
<wsdl:input>
|
||||
<soap12:body use="literal" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap12:body use="literal" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="GetUKLocationByTown">
|
||||
<soap12:operation soapAction="http://www.webserviceX.NET/GetUKLocationByTown" style="document" />
|
||||
<wsdl:input>
|
||||
<soap12:body use="literal" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap12:body use="literal" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="GetUKLocationByPostCode">
|
||||
<soap12:operation soapAction="http://www.webserviceX.NET/GetUKLocationByPostCode" style="document" />
|
||||
<wsdl:input>
|
||||
<soap12:body use="literal" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap12:body use="literal" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="ValidateUKAddress">
|
||||
<soap12:operation soapAction="http://www.webserviceX.NET/ValidateUKAddress" style="document" />
|
||||
<wsdl:input>
|
||||
<soap12:body use="literal" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap12:body use="literal" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
</wsdl:binding>
|
||||
<wsdl:binding name="UKLocationHttpGet" type="tns:UKLocationHttpGet">
|
||||
<http:binding verb="GET" />
|
||||
<wsdl:operation name="GetUKLocationByCounty">
|
||||
<http:operation location="/GetUKLocationByCounty" />
|
||||
<wsdl:input>
|
||||
<http:urlEncoded />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<mime:mimeXml part="Body" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="GetUKLocationByTown">
|
||||
<http:operation location="/GetUKLocationByTown" />
|
||||
<wsdl:input>
|
||||
<http:urlEncoded />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<mime:mimeXml part="Body" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="GetUKLocationByPostCode">
|
||||
<http:operation location="/GetUKLocationByPostCode" />
|
||||
<wsdl:input>
|
||||
<http:urlEncoded />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<mime:mimeXml part="Body" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="ValidateUKAddress">
|
||||
<http:operation location="/ValidateUKAddress" />
|
||||
<wsdl:input>
|
||||
<http:urlEncoded />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<mime:mimeXml part="Body" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
</wsdl:binding>
|
||||
<wsdl:binding name="UKLocationHttpPost" type="tns:UKLocationHttpPost">
|
||||
<http:binding verb="POST" />
|
||||
<wsdl:operation name="GetUKLocationByCounty">
|
||||
<http:operation location="/GetUKLocationByCounty" />
|
||||
<wsdl:input>
|
||||
<mime:content type="application/x-www-form-urlencoded" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<mime:mimeXml part="Body" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="GetUKLocationByTown">
|
||||
<http:operation location="/GetUKLocationByTown" />
|
||||
<wsdl:input>
|
||||
<mime:content type="application/x-www-form-urlencoded" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<mime:mimeXml part="Body" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="GetUKLocationByPostCode">
|
||||
<http:operation location="/GetUKLocationByPostCode" />
|
||||
<wsdl:input>
|
||||
<mime:content type="application/x-www-form-urlencoded" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<mime:mimeXml part="Body" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="ValidateUKAddress">
|
||||
<http:operation location="/ValidateUKAddress" />
|
||||
<wsdl:input>
|
||||
<mime:content type="application/x-www-form-urlencoded" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<mime:mimeXml part="Body" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
</wsdl:binding>
|
||||
<wsdl:service name="UKLocation">
|
||||
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get UK Postcode,Town,County and Validate UK Address</wsdl:documentation>
|
||||
<wsdl:port name="UKLocationSoap" binding="tns:UKLocationSoap">
|
||||
<soap:address location="http://www.webservicex.net/uklocation.asmx" />
|
||||
</wsdl:port>
|
||||
<wsdl:port name="UKLocationSoap12" binding="tns:UKLocationSoap12">
|
||||
<soap12:address location="http://www.webservicex.net/uklocation.asmx" />
|
||||
</wsdl:port>
|
||||
<wsdl:port name="UKLocationHttpGet" binding="tns:UKLocationHttpGet">
|
||||
<http:address location="http://www.webservicex.net/uklocation.asmx" />
|
||||
</wsdl:port>
|
||||
<wsdl:port name="UKLocationHttpPost" binding="tns:UKLocationHttpPost">
|
||||
<http:address location="http://www.webservicex.net/uklocation.asmx" />
|
||||
</wsdl:port>
|
||||
</wsdl:service>
|
||||
</wsdl:definitions>
|
@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://www.webserviceX.NET"><env:Body><ns1:GetUKLocationByCounty><ns1:County>London</ns1:County></ns1:GetUKLocationByCounty></env:Body></env:Envelope>
|
@ -0,0 +1,24 @@
|
||||
|
||||
--Part_10_589b2dcf4f7fb.589b2dcf4f804
|
||||
Content-Type: application/soap+xml; charset=utf-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Content-ID: <part-7e61b8e0-f84d-4cf7-8043-3c27d90767af@response.info>
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://www.webserviceX.NET"><env:Body><ns1:GetUKLocationByCounty><ns1:County>London</ns1:County></ns1:GetUKLocationByCounty></env:Body></env:Envelope>
|
||||
|
||||
--Part_10_589b2dcf4f7fb.589b2dcf4f804
|
||||
Content-Type: application/pdf; charset=utf-8
|
||||
Content-Transfer-Encoding: binary
|
||||
Content-ID: <first-file.txt>
|
||||
Content-Location: first-file.txt
|
||||
|
||||
hello world
|
||||
--Part_10_589b2dcf4f7fb.589b2dcf4f804
|
||||
Content-Type: application/pdf; charset=utf-8
|
||||
Content-Transfer-Encoding: binary
|
||||
Content-ID: <second-file.txt>
|
||||
Content-Location: second-file.txt
|
||||
|
||||
hello world
|
||||
--Part_10_589b2dcf4f7fb.589b2dcf4f804--
|
Reference in New Issue
Block a user