UnitTests are now located in tests directory & tiny improvements

This commit is contained in:
Petr Bechyně
2017-03-15 10:25:48 +01:00
parent 21d705bbfa
commit d3023b1a5a
115 changed files with 206 additions and 3816 deletions

View File

@ -0,0 +1,94 @@
<?php
namespace BeSimple\SoapClient;
use BeSimple\SoapClient\Curl\CurlOptions;
use BeSimple\SoapClient\SoapOptions\SoapClientOptions;
use BeSimple\SoapCommon\ClassMap;
use BeSimple\SoapCommon\SoapOptions\SoapOptions;
use BeSimple\SoapCommon\SoapOptionsBuilder;
use PHPUnit_Framework_TestCase;
use SoapClient;
class SoapClientBuilderTest extends PHPUnit_Framework_TestCase
{
const CACHE_DIR = __DIR__ . '/../../../cache';
const FIXTURES_DIR = __DIR__ . '/../../Fixtures';
const TEST_REMOTE_WSDL_UK = 'http://www.webservicex.net/uklocation.asmx?WSDL';
const TEST_LOCAL_WSDL_UK = self::FIXTURES_DIR.'/localWsdl.wsdl';
public function testSoapOptionsCreateWithDefaults()
{
$defaultOptions = SoapOptionsBuilder::createWithDefaults(self::TEST_LOCAL_WSDL_UK);
self::assertInstanceOf(SoapOptions::class, $defaultOptions);
self::assertEquals(self::TEST_LOCAL_WSDL_UK, $defaultOptions->getWsdlFile());
}
public function testSoapClientOptionsCreateWithDefaults()
{
$defaultOptions = SoapClientOptionsBuilder::createWithDefaults();
self::assertInstanceOf(SoapClientOptions::class, $defaultOptions);
self::assertEquals(CurlOptions::DEFAULT_USER_AGENT, $defaultOptions->getUserAgent());
}
public function testConstructSoapClientWithDefaults()
{
$soapClient = $this->getSoapBuilder()->build(
SoapClientOptionsBuilder::createWithDefaults(),
SoapOptionsBuilder::createWithDefaults(self::TEST_REMOTE_WSDL_UK)
);
self::assertInstanceOf(SoapClient::class, $soapClient);
}
public function testConstructSoapClientWithSwaAndClassMapAndCacheDisk()
{
$soapOptions = SoapOptionsBuilder::createSwaWithClassMap(
self::TEST_REMOTE_WSDL_UK,
new ClassMap(),
SoapOptions::SOAP_CACHE_TYPE_DISK,
self::CACHE_DIR
);
$soapClient = $this->getSoapBuilder()->build(
SoapClientOptionsBuilder::createWithDefaults(),
$soapOptions
);
self::assertInstanceOf(SoapClient::class, $soapClient);
}
public function testConstructSoapClientWithDefaultsAndLocalWsdlFile()
{
$soapClient = $this->getSoapBuilder()->build(
SoapClientOptionsBuilder::createWithDefaults(),
SoapOptionsBuilder::createWithDefaults(self::TEST_LOCAL_WSDL_UK)
);
self::assertInstanceOf(SoapClient::class, $soapClient);
}
public function testConstructSoapClientWithSwaAndClassMapAndCacheDiskAndLocalWsdlFile()
{
$soapOptions = SoapOptionsBuilder::createSwaWithClassMap(
self::TEST_LOCAL_WSDL_UK,
new ClassMap(),
SoapOptions::SOAP_CACHE_TYPE_DISK,
self::CACHE_DIR
);
$soapClient = $this->getSoapBuilder()->build(
SoapClientOptionsBuilder::createWithDefaults(),
$soapOptions
);
self::assertInstanceOf(SoapClient::class, $soapClient);
}
private function getSoapBuilder()
{
return new SoapClientBuilder();
}
}

View File

@ -0,0 +1,304 @@
<?php
namespace BeSimple\SoapClient;
use BeSimple\SoapBundle\Soap\SoapAttachment;
use BeSimple\SoapCommon\ClassMap;
use BeSimple\SoapCommon\SoapOptions\SoapOptions;
use BeSimple\SoapCommon\SoapOptionsBuilder;
use Exception;
use Fixtures\GenerateTestRequest;
use Fixtures\GetUKLocationByCounty;
use PHPUnit_Framework_TestCase;
use SoapHeader;
class SoapClientTest extends PHPUnit_Framework_TestCase
{
const CACHE_DIR = __DIR__ . '/../../../cache';
const FIXTURES_DIR = __DIR__ . '/../../Fixtures';
const TEST_ENDPOINT_UK = 'http://www.webservicex.net/uklocation.asmx';
const TEST_REMOTE_WSDL_UK = 'http://www.webservicex.net/uklocation.asmx?WSDL';
const TEST_REMOTE_ENDPOINT_NOT_WORKING = 'http://www.nosuchserverexist.tld/doesnotexist.endpoint';
const TEST_REMOTE_WSDL_NOT_WORKING = 'http://www.nosuchserverexist.tld/doesnotexist.endpoint?wsdl';
const TEST_REMOTE_WSDL_SWA = 'https://demo2815480.mockable.io/soap/testGenerator?WSDL';
public function testSoapCall()
{
$soapClient = $this->getSoapBuilder()->build(
SoapClientOptionsBuilder::createWithDefaults(),
SoapOptionsBuilder::createWithDefaults(self::TEST_REMOTE_WSDL_UK)
);
$getUKLocationByCountyRequest = new GetUKLocationByCounty();
$getUKLocationByCountyRequest->County = 'London';
$soapResponse = $soapClient->soapCall('GetUKLocationByCounty', [$getUKLocationByCountyRequest]);
self::assertContains('GetUKLocationByCountyResult', $soapResponse->getContent());
self::assertContains('</GetUKLocationByCountyResponse>', $soapResponse->getContent());
self::assertEquals(self::TEST_ENDPOINT_UK, $soapResponse->getLocation());
}
public function testSoapCallWithCustomEndpointValid()
{
$soapClient = $this->getSoapBuilder()->build(
SoapClientOptionsBuilder::createWithEndpointLocation(self::TEST_ENDPOINT_UK),
SoapOptionsBuilder::createWithDefaults(self::TEST_REMOTE_WSDL_UK)
);
$getUKLocationByCountyRequest = new GetUKLocationByCounty();
$getUKLocationByCountyRequest->County = 'London';
$soapResponse = $soapClient->soapCall('GetUKLocationByCounty', [$getUKLocationByCountyRequest]);
self::assertContains('Connection: close', $soapResponse->getTracingData()->getLastRequestHeaders());
self::assertContains('County>London</', $soapResponse->getTracingData()->getLastRequest());
self::assertContains('GetUKLocationByCountyResult', $soapResponse->getContent());
self::assertContains('</GetUKLocationByCountyResponse>', $soapResponse->getContent());
self::assertEquals(self::TEST_ENDPOINT_UK, $soapResponse->getLocation());
}
public function testSoapCallWithKeepAliveTrue()
{
$soapClient = $this->getSoapBuilder()->build(
SoapClientOptionsBuilder::createWithEndpointLocation(self::TEST_ENDPOINT_UK),
SoapOptionsBuilder::createWithDefaultsKeepAlive(self::TEST_REMOTE_WSDL_UK)
);
$getUKLocationByCountyRequest = new GetUKLocationByCounty();
$getUKLocationByCountyRequest->County = 'London';
$soapResponse = $soapClient->soapCall('GetUKLocationByCounty', [$getUKLocationByCountyRequest]);
self::assertContains('Connection: Keep-Alive', $soapResponse->getTracingData()->getLastRequestHeaders());
self::assertContains('County>London</', $soapResponse->getTracingData()->getLastRequest());
self::assertContains('GetUKLocationByCountyResult', $soapResponse->getContent());
self::assertContains('</GetUKLocationByCountyResponse>', $soapResponse->getContent());
self::assertEquals(self::TEST_ENDPOINT_UK, $soapResponse->getLocation());
}
public function testSoapCallWithCustomEndpointInvalidShouldFail()
{
$this->setExpectedException(Exception::class, 'Could not resolve host');
$soapClient = $this->getSoapBuilder()->build(
SoapClientOptionsBuilder::createWithEndpointLocation(self::TEST_REMOTE_ENDPOINT_NOT_WORKING),
SoapOptionsBuilder::createWithDefaults(self::TEST_REMOTE_WSDL_UK)
);
$getUKLocationByCountyRequest = new GetUKLocationByCounty();
$getUKLocationByCountyRequest->County = 'London';
$soapClient->soapCall('GetUKLocationByCounty', [$getUKLocationByCountyRequest]);
}
public function testSoapCallWithCacheEndpointDownShouldFail()
{
$this->setExpectedException(Exception::class, 'Could not write WSDL cache file: Download failed with message');
$this->getSoapBuilder()->build(
SoapClientOptionsBuilder::createWithDefaults(),
SoapOptionsBuilder::createWithDefaults(
self::TEST_REMOTE_WSDL_NOT_WORKING,
SoapOptions::SOAP_CACHE_TYPE_DISK,
self::CACHE_DIR
)
);
}
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,
self::CACHE_DIR
)
);
$getUKLocationByCountyRequest = new GetUKLocationByCounty();
$getUKLocationByCountyRequest->County = 'London';
try {
$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(self::FIXTURES_DIR.'/soapRequestWithTwoAttachments.request')),
$this->removeOneTimeData($tracingData->getLastRequest()),
'Requests must match after onetime data were removed'
);
}
public function testSoapCallSwaWithNoAttachments()
{
$soapClient = $this->getSoapBuilder()->build(
SoapClientOptionsBuilder::createWithTracing(),
SoapOptionsBuilder::createSwaWithClassMap(
self::TEST_REMOTE_WSDL_UK,
new ClassMap(),
SoapOptions::SOAP_CACHE_TYPE_DISK,
self::CACHE_DIR
)
);
$getUKLocationByCountyRequest = new GetUKLocationByCounty();
$getUKLocationByCountyRequest->County = 'London';
try {
$soapResponse = $soapClient->soapCall(
'GetUKLocationByCounty',
[$getUKLocationByCountyRequest]
);
$tracingData = $soapResponse->getTracingData();
} catch (SoapFaultWithTracingData $e) {
$tracingData = $e->getSoapResponseTracingData();
}
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::assertStringEqualsFile(
self::FIXTURES_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,
self::CACHE_DIR
),
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());
}
public function removeOneTimeData($string)
{
$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');
}
private function getSoapBuilder()
{
return new SoapClientBuilder();
}
}

View File

@ -0,0 +1,48 @@
<?php
namespace BeSimple\SoapServer;
use BeSimple\SoapClient\SoapClientBuilderTest;
use BeSimple\SoapCommon\SoapOptions\SoapOptions;
use BeSimple\SoapCommon\SoapOptionsBuilder;
use BeSimple\SoapServer\SoapOptions\SoapServerOptions;
use Fixtures\SoapServerHandler;
use PHPUnit_Framework_TestCase;
class SoapServerBuilderTest extends PHPUnit_Framework_TestCase
{
const CACHE_DIR = __DIR__ . '/../../../cache';
const FIXTURES_DIR = __DIR__ . '/../../Fixtures';
const TEST_LOCAL_WSDL_UK = SoapClientBuilderTest::TEST_LOCAL_WSDL_UK;
public function testSoapOptionsCreateWithDefaults()
{
$defaultOptions = SoapOptionsBuilder::createWithDefaults(self::TEST_LOCAL_WSDL_UK);
self::assertInstanceOf(SoapOptions::class, $defaultOptions);
self::assertEquals(self::TEST_LOCAL_WSDL_UK, $defaultOptions->getWsdlFile());
}
public function testSoapServerOptionsCreateWithDefaults()
{
$defaultOptions = SoapServerOptionsBuilder::createWithDefaults(new SoapServerHandler());
self::assertInstanceOf(SoapServerOptions::class, $defaultOptions);
self::assertInstanceOf(SoapServerHandler::class, $defaultOptions->getHandlerInstance());
}
public function testSoapServerBuilderBuild()
{
$soapServer = $this->getSoapServerBuilder()->build(
SoapServerOptionsBuilder::createWithDefaults(new SoapServerHandler()),
SoapOptionsBuilder::createWithDefaults(self::TEST_LOCAL_WSDL_UK)
);
self::assertInstanceOf(SoapServer::class, $soapServer);
}
public function getSoapServerBuilder()
{
return new SoapServerBuilder();
}
}

View File

@ -0,0 +1,122 @@
<?php
namespace BeSimple\SoapServer;
use BeSimple\SoapClient\SoapClientBuilderTest;
use BeSimple\SoapCommon\ClassMap;
use BeSimple\SoapCommon\SoapOptionsBuilder;
use Fixtures\DummyService;
use Fixtures\SoapServerHandler;
use PHPUnit_Framework_TestCase;
class SoapServerTest extends PHPUnit_Framework_TestCase
{
const CACHE_DIR = __DIR__ . '/../../../cache';
const FIXTURES_DIR = __DIR__ . '/../../Fixtures';
const TEST_LOCAL_WSDL_UK = SoapClientBuilderTest::TEST_LOCAL_WSDL_UK;
public function testCreateRequest()
{
$soapServer = $this->getSoapServerBuilder()->build(
SoapServerOptionsBuilder::createWithDefaults(new SoapServerHandler()),
SoapOptionsBuilder::createWithDefaults(self::TEST_LOCAL_WSDL_UK)
);
$soapRequest = $soapServer->createRequest('request-url', 'soap-action', 'content/type', 'request-content');
self::assertEquals('content/type', $soapRequest->getContentType());
self::assertEquals('soap-action', $soapRequest->getAction());
self::assertEquals('request-content', $soapRequest->getContent());
self::assertFalse($soapRequest->hasAttachments());
self::assertNull($soapRequest->getAttachments());
}
public function testHandleRequest()
{
$dummyService = new DummyService();
$classMap = new ClassMap();
foreach ($dummyService->getClassMap() as $type => $className) {
$classMap->add($type, $className);
}
$soapServerBuilder = new SoapServerBuilder();
$soapServerOptions = SoapServerOptionsBuilder::createWithDefaults($dummyService);
$soapOptions = SoapOptionsBuilder::createWithClassMap($dummyService->getWsdlPath(), $classMap);
$soapServer = $soapServerBuilder->build($soapServerOptions, $soapOptions);
$request = $soapServer->createRequest(
$dummyService->getEndpoint(),
'DummyService.dummyServiceMethod',
'text/xml;charset=UTF-8',
file_get_contents(self::FIXTURES_DIR.DIRECTORY_SEPARATOR.'testHandleRequest.message')
);
$response = $soapServer->handleRequest($request);
file_put_contents(self::CACHE_DIR . '/SoapServerTestResponse.xml', $response->getContent());
self::assertNotContains("\r\n", $response->getContent(), 'Response cannot contain CRLF line endings');
self::assertContains('dummyServiceMethodResponse', $response->getContent());
self::assertSame('DummyService.dummyServiceMethod', $response->getAction());
self::assertFalse($response->hasAttachments(), 'Response should not contain attachments');
}
public function testHandleRequestWithSwa()
{
$dummyService = new DummyService();
$classMap = new ClassMap();
foreach ($dummyService->getClassMap() as $type => $className) {
$classMap->add($type, $className);
}
$soapServerBuilder = new SoapServerBuilder();
$soapServerOptions = SoapServerOptionsBuilder::createWithDefaults($dummyService);
$soapOptions = SoapOptionsBuilder::createSwaWithClassMap($dummyService->getWsdlPath(), $classMap);
$soapServer = $soapServerBuilder->build($soapServerOptions, $soapOptions);
$request = $soapServer->createRequest(
$dummyService->getEndpoint(),
'DummyService.dummyServiceMethodWithAttachments',
'text/xml;charset=UTF-8',
file_get_contents(self::FIXTURES_DIR.DIRECTORY_SEPARATOR.'testHandleRequestWithSwa.message')
);
$response = $soapServer->handleRequest($request);
file_put_contents(self::CACHE_DIR . '/SoapServerTestResponseFromSwaRequestWithNoAttachments.xml', $response->getContent());
self::assertNotContains("\r\n", $response->getContent(), 'Response cannot contain CRLF line endings');
self::assertContains('dummyServiceMethodWithAttachmentsResponse', $response->getContent());
self::assertSame('DummyService.dummyServiceMethodWithAttachments', $response->getAction());
self::assertFalse($response->hasAttachments(), 'Response should contain attachments');
}
public function testHandleRequestWithSwaResponse()
{
$dummyService = new DummyService();
$classMap = new ClassMap();
foreach ($dummyService->getClassMap() as $type => $className) {
$classMap->add($type, $className);
}
$soapServerBuilder = new SoapServerBuilder();
$soapServerOptions = SoapServerOptionsBuilder::createWithDefaults($dummyService);
$soapOptions = SoapOptionsBuilder::createSwaWithClassMap($dummyService->getWsdlPath(), $classMap);
$soapServer = $soapServerBuilder->build($soapServerOptions, $soapOptions);
$request = $soapServer->createRequest(
$dummyService->getEndpoint(),
'DummyService.dummyServiceMethodWithAttachments',
'multipart/related; type="text/xml"; start="<rootpart@soapui.org>"; boundary="----=_Part_6_2094841787.1482231370463"',
file_get_contents(self::FIXTURES_DIR.DIRECTORY_SEPARATOR.'testHandleRequestWithSwa.mimepart.message')
);
$response = $soapServer->handleRequest($request);
file_put_contents(self::CACHE_DIR . '/SoapServerTestSwaResponseWithAttachments.xml', $response->getContent());
self::assertNotContains("\r\n", $response->getContent(), 'Response cannot contain CRLF line endings');
self::assertContains('dummyServiceMethodWithAttachmentsResponse', $response->getContent());
self::assertSame('DummyService.dummyServiceMethodWithAttachments', $response->getAction());
self::assertTrue($response->hasAttachments(), 'Response should contain attachments');
self::assertCount(2, $response->getAttachments());
}
public function getSoapServerBuilder()
{
return new SoapServerBuilder();
}
}

View File

@ -0,0 +1,35 @@
<?php
namespace Fixtures\Attachment;
class Attachment
{
/**
* @var string $fileName
*/
public $fileName;
/**
* @var string $content
*/
public $contentType;
/**
* @var string $content
*/
public $content;
/**
* Attachment constructor.
*
* @param string $fileName
* @param string $contentType
* @param string $content
*/
public function __construct($fileName, $contentType, $content)
{
$this->fileName = $fileName;
$this->contentType = $contentType;
$this->content = $content;
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace Fixtures\Attachment;
class AttachmentCollection
{
/**
* @var Attachment[] $attachments
*/
public $attachments;
public function __construct(array $attachments = null)
{
$this->attachments = $attachments;
}
public function hasAttachments()
{
return $this->attachments !== null && count($this->attachments) > 0;
}
}

View File

@ -0,0 +1,106 @@
<?php
namespace Fixtures;
use BeSimple\SoapBundle\Soap\SoapAttachment;
use BeSimple\SoapCommon\AttachmentsHandlerInterface;
use BeSimple\SoapCommon\Storage\RequestHandlerAttachmentsStorage;
use Fixtures\Attachment\Attachment;
use Fixtures\Attachment\AttachmentCollection;
use ReflectionClass;
class DummyService implements AttachmentsHandlerInterface
{
/** @var RequestHandlerAttachmentsStorage */
private $requestHandlerAttachmentsStorage;
public function addAttachmentStorage(RequestHandlerAttachmentsStorage $requestHandlerAttachmentsStorage)
{
$this->requestHandlerAttachmentsStorage = $requestHandlerAttachmentsStorage;
}
public function getAttachmentStorage()
{
return $this->requestHandlerAttachmentsStorage;
}
/**
* @return string[]
*/
public function getClassMap()
{
return [
'DummyServiceResponse' => DummyServiceResponse::class,
'DummyServiceResponseWithAttachments' => DummyServiceResponseWithAttachments::class,
'DummyServiceRequest' => DummyServiceRequest::class,
'DummyServiceRequestWithAttachments' => DummyServiceRequestWithAttachments::class,
];
}
/**
* @exclude
* @return string
*/
public function getWsdlPath()
{
$class = new ReflectionClass(static::class);
return __DIR__.DIRECTORY_SEPARATOR.$class->getShortName().'.wsdl';
}
/**
* @return string
*/
public function getEndpoint()
{
return 'http://my.test/soap/dummyService';
}
/**
* @param DummyServiceRequest $dummyServiceRequest
* @return DummyServiceResponse
*/
public function dummyServiceMethod(DummyServiceRequest $dummyServiceRequest)
{
$dummyServiceHandler = new DummyServiceHandler();
return $dummyServiceHandler->handle($dummyServiceRequest);
}
/**
* @param DummyServiceRequestWithAttachments $dummyServiceRequestWithAttachments
* @return DummyServiceResponseWithAttachments
*/
public function dummyServiceMethodWithAttachments(DummyServiceRequestWithAttachments $dummyServiceRequestWithAttachments)
{
if ($dummyServiceRequestWithAttachments->hasAttachments() === true) {
$attachmentStorage = $this->getAttachmentStorage();
$attachments = [];
foreach ($attachmentStorage->getAttachments() as $soapAttachment) {
$attachments[] = new Attachment(
$soapAttachment->getId(),
$soapAttachment->getType(),
$soapAttachment->getContent()
);
}
$dummyServiceRequestWithAttachments->attachmentCollection = new AttachmentCollection($attachments);
}
$dummyServiceHandlerWithAttachments = new DummyServiceHandlerWithAttachments();
$dummyServiceResponseWithAttachments = $dummyServiceHandlerWithAttachments->handle($dummyServiceRequestWithAttachments);
if ($dummyServiceResponseWithAttachments->hasAttachments() === true) {
$soapAttachments = [];
foreach ($dummyServiceResponseWithAttachments->attachmentCollection->attachments as $attachment) {
$soapAttachments[] = new SoapAttachment(
$attachment->fileName,
$attachment->contentType,
$attachment->content
);
}
$this->addAttachmentStorage(new RequestHandlerAttachmentsStorage($soapAttachments));
}
return $dummyServiceResponseWithAttachments;
}
}

View File

@ -0,0 +1,92 @@
<?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="DummyServiceRequest">
<xsd:sequence>
<xsd:element name="dummyAttribute" type="xsd:int" minOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="DummyServiceResponse">
<xsd:sequence>
<xsd:element name="status" type="xsd:boolean" minOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="DummyServiceRequestWithAttachments">
<xsd:sequence>
<xsd:element name="dummyAttribute" type="xsd:int" minOccurs="1"/>
<xsd:element name="includeAttachments" type="xsd:boolean" minOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="DummyServiceResponseWithAttachments">
<xsd:sequence>
<xsd:element name="status" type="xsd:boolean" minOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<message name="SoapHeader">
<part name="SoapHeader" element="tns:SoapHeader"/>
</message>
<message name="DummyServiceRequest">
<part name="request" type="tns:DummyServiceRequest"/>
</message>
<message name="DummyServiceRequestWithAttachments">
<part name="request" type="tns:DummyServiceRequestWithAttachments"/>
</message>
<message name="DummyServiceResponse">
<part name="dummyServiceReturn" type="tns:DummyServiceResponse"/>
</message>
<message name="DummyServiceResponseWithAttachments">
<part name="dummyServiceReturn" type="tns:DummyServiceResponseWithAttachments"/>
</message>
<wsdl:portType name="DummyServiceSoapPortType">
<wsdl:operation name="dummyServiceMethod">
<wsdl:input message="tns:DummyServiceRequest"/>
<wsdl:output message="tns:DummyServiceResponse"/>
</wsdl:operation>
<wsdl:operation name="dummyServiceMethodWithAttachments">
<wsdl:input message="tns:DummyServiceRequestWithAttachments"/>
<wsdl:output message="tns:DummyServiceResponseWithAttachments"/>
</wsdl:operation>
</wsdl:portType>
<binding name="DummyServiceSoapBinding" type="tns:DummyServiceSoapPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="dummyServiceMethod">
<soap:operation soapAction="DummyService.dummyServiceMethod" 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>
<wsdl:operation name="dummyServiceMethodWithAttachments">
<soap:operation soapAction="DummyService.dummyServiceMethodWithAttachments" 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="DummyService">
<xsd:documentation>WSDL file for DummyService</xsd:documentation>
<port name="DummyServiceSoapPortType" binding="tns:DummyServiceSoapBinding">
<soap:address location="http://schema.testcase"/>
</port>
</wsdl:service>
</wsdl:definitions>

View File

@ -0,0 +1,18 @@
<?php
namespace Fixtures;
class DummyServiceHandler
{
/**
* @param DummyServiceRequest
* @return DummyServiceResponse
*/
public function handle(DummyServiceRequest $request)
{
$response = new DummyServiceResponse();
$response->status = true;
return $response;
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace Fixtures;
use Fixtures\Attachment\Attachment;
use Fixtures\Attachment\AttachmentCollection;
class DummyServiceHandlerWithAttachments
{
/**
* @param DummyServiceRequestWithAttachments $request
* @return DummyServiceResponseWithAttachments
*/
public function handle(DummyServiceRequestWithAttachments $request)
{
$response = new DummyServiceResponseWithAttachments();
$response->status = true;
if ($request->includeAttachments === true) {
if ($request->hasAttachments() === true) {
$attachments = [];
foreach ($request->attachmentCollection->attachments as $attachment) {
$attachments[] = new Attachment($attachment->fileName, $attachment->contentType, $attachment->content);
}
$response->attachmentCollection = new AttachmentCollection($attachments);
}
}
return $response;
}
}

View File

@ -0,0 +1,11 @@
<?php
namespace Fixtures;
class DummyServiceRequest
{
/**
* @var int $dummyAttribute
*/
public $dummyAttribute;
}

View File

@ -0,0 +1,28 @@
<?php
namespace Fixtures;
use Fixtures\Attachment\AttachmentCollection;
class DummyServiceRequestWithAttachments
{
/**
* @var int $dummyAttribute
*/
public $dummyAttribute;
/**
* @var bool $includeAttachments
*/
public $includeAttachments;
/**
* @var AttachmentCollection $attachmentCollection
*/
public $attachmentCollection;
public function hasAttachments()
{
return $this->attachmentCollection !== null && $this->attachmentCollection->hasAttachments();
}
}

View File

@ -0,0 +1,11 @@
<?php
namespace Fixtures;
class DummyServiceResponse
{
/**
* @var bool $status
*/
public $status;
}

View File

@ -0,0 +1,23 @@
<?php
namespace Fixtures;
use Fixtures\Attachment\AttachmentCollection;
class DummyServiceResponseWithAttachments
{
/**
* @var bool $status
*/
public $status;
/**
* @var AttachmentCollection $attachmentCollection
*/
public $attachmentCollection;
public function hasAttachments()
{
return $this->attachmentCollection !== null && $this->attachmentCollection->hasAttachments();
}
}

View File

@ -0,0 +1,8 @@
<?php
namespace Fixtures;
class GenerateTestRequest
{
public $salutation;
}

View File

@ -0,0 +1,8 @@
<?php
namespace Fixtures;
class GetUKLocationByCounty
{
public $County;
}

View File

@ -0,0 +1,7 @@
<?php
namespace Fixtures;
class SoapServerHandler
{
}

View 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>

View File

@ -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>

View File

@ -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--

View File

@ -0,0 +1,14 @@
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://schema.testcase">
<soapenv:Header>
<sch:SoapHeader>
<user>admin</user>
</sch:SoapHeader>
</soapenv:Header>
<soapenv:Body>
<sch:dummyServiceMethod>
<request>
<dummyAttribute>1</dummyAttribute>
</request>
</sch:dummyServiceMethod>
</soapenv:Body>
</soapenv:Envelope>

View File

@ -0,0 +1,15 @@
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://schema.testcase">
<soapenv:Header>
<sch:SoapHeader>
<user>admin</user>
</sch:SoapHeader>
</soapenv:Header>
<soapenv:Body>
<sch:dummyServiceMethodWithAttachments>
<request>
<dummyAttribute>2</dummyAttribute>
<includeAttachments>false</includeAttachments>
</request>
</sch:dummyServiceMethodWithAttachments>
</soapenv:Body>
</soapenv:Envelope>

View File

@ -0,0 +1,62 @@
------=_Part_6_2094841787.1482231370463
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID: <rootpart@soapui.org>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://schema.testcase">
<soapenv:Header>
<sch:SoapHeader>
<user>admin</user>
</sch:SoapHeader>
</soapenv:Header>
<soapenv:Body>
<sch:dummyServiceMethodWithAttachments>
<request>
<dummyAttribute>3</dummyAttribute>
<includeAttachments>true</includeAttachments>
</request>
</sch:dummyServiceMethodWithAttachments>
</soapenv:Body>
</soapenv:Envelope>
------=_Part_6_2094841787.1482231370463
Content-Type: text/html; charset=us-ascii; name=test-page.html
Content-Transfer-Encoding: 7bit
Content-ID: <test-page.html>
Content-Disposition: attachment; name="test-page.html"; filename="test-page.html"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Test file page</title>
<style type="text/css">
<!--
h1 {
font-family: Arial, Helvetica, sans-serif;
font-size: 11pt;
}
-->
</style>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
------=_Part_6_2094841787.1482231370463
Content-Type: application/x-sh; name=testscript.sh
Content-Transfer-Encoding: binary
Content-ID: <testscript.sh>
Content-Disposition: attachment; name="testscript.sh"; filename="testscript.sh"
#!/bin/sh
### ====================================================================== ###
## ##
## Test Script ##
## ##
### ====================================================================== ###
------=_Part_6_2094841787.1482231370463--