SOAP WSDL: Unterschied zwischen den Versionen

Aus expecco Wiki (Version 2.x)
Zur Navigation springen Zur Suche springen
Zeile 45: Zeile 45:
use the following setup:
use the following setup:
<CODE><PRE>
<CODE><PRE>
transport := SptHTTPLocalTransport new.
localTransport := SptHTTPLocalTransport new.

localDocuments := transport localDocuments.
localDocuments
localTransport localDocuments
at: urlA "eg something like: 'http://foo.services.de:30050/partner/PartnerBusinessService?SCHEMA'"
at: urlA "eg something like: 'http://foo.services.de:30050/partner/PartnerBusinessService?SCHEMA'"
put:
put:
Zeile 53: Zeile 53:
... the whole urlA document as string...
... the whole urlA document as string...
'.
'.

localDocuments
localTransport localDocuments
at: urlB "eg something like: 'http://foo.services.de..."
at: urlB "eg something like: 'http://foo.services.de..."
put:
put:
Zeile 59: Zeile 60:
... the whole urlB document as string...
... the whole urlB document as string...
'.
'.

localDocuments
localTransport localDocuments
at: urlC "eg something like: 'http://foo.services.de..."
at: urlC "eg something like: 'http://foo.services.de..."
put:
put:
Zeile 66: Zeile 68:
'.
'.
</PRE></CODE>
</PRE></CODE>
and create the service with:
and define this as defaultTransport in your client class.
<CODE><PRE>
Then, all required import urls will be fetched from there.
definitions := WSDLDefinitions
onUrl: urlA
transport: localTransport.
service := SprayWSDLService onDefinitions: definitions.
</PRE></CODE>
Then, all required import urls will be fetched from there (eg. no HTTP requests required).

Of course, you can also read the docuemnts from a local file, and setup the localTransport instance
from their contents.

Version vom 2. Juli 2015, 13:33 Uhr

SOAP WSDL Package[Bearbeiten]

Basic Usage[Bearbeiten]

These chapter describes the basic underlying implementation. It does not require or use the WSDL class generator.


To make a SOAP request as a client, given a WSDL (either as file, string or URL), you have to:

  • create a service
  • instantiate a client
  • create a call object with call arguments
  • perform the call
  • extract the values from the returned result object

Creating a Service Instance[Bearbeiten]

You need a WSDL to create a service. This can come from multiple sources:

Service from URL (preferred)[Bearbeiten]

this is the preferred method, especially as it wil deal automatically with imported schema definitions (i.e. if the WSDL refers to other documents via an import)

    service := SprayWSDLService onUrl: 'anUrlString'
Service from a String[Bearbeiten]

this only works, if the WSDL is self contained (eg. contains all required definitions and does not import other documents)

    service := SprayWSDLService onXmlString: 'wsdlString'
From a set of Files/Strings[Bearbeiten]

when a WSDL URL is parsed, an transport object instance is used to fetch imported documents. By default, an instance of SptHTTPClient is used to fetch required documents. A mock transport class named SptHTTPLocalTransport can be used. This keeps a list of string documents variable and delivers that contents, when asked for. Thus, if you have a WSDL document, which imports other documents, AND you want to prevent WSDL fetches via http at runtime of you program, you can setup an instance of SptHTTPLocalTransport, give it all the documents (incl. any imported docs), and provide that as a document retriever. For example, if you have a WSDL in (urlA), which imports urlB and urlC, and urlC imports urlD, use the following setup:

    localTransport := SptHTTPLocalTransport new.

    localTransport localDocuments
        at: urlA "eg something like: 'http://foo.services.de:30050/partner/PartnerBusinessService?SCHEMA'"
        put:
'<?xml version="1.0"?> 
... the whole urlA document as string...
'.

   localTransport localDocuments
        at: urlB "eg something like: 'http://foo.services.de..."
        put:
'<?xml version="1.0"?> 
... the whole urlB document as string...
'.

   localTransport localDocuments
        at: urlC "eg something like: 'http://foo.services.de..."
        put:
'<?xml version="1.0"?> 
... the whole urlC document as string...
'.

and create the service with:

    definitions := WSDLDefinitions 
                onUrl: urlA
                transport: localTransport.
    service := SprayWSDLService onDefinitions: definitions.

Then, all required import urls will be fetched from there (eg. no HTTP requests required).

Of course, you can also read the docuemnts from a local file, and setup the localTransport instance from their contents.



Copyright © 2014-2024 eXept Software AG