Sometimes, the Delphi WSDL importer imports fine, but the generated code does not accept test cases sent by other tools.
Below are some links for messages and comment fragments that I want to investigate further.
// Cannot unwrap:
// - Input element wrapper name does not match operation's name
// - The output part is not a complex type// CODEGEN: Generating message contract since the operation prematchChanged is neither RPC nor document wrapped.
I have included the .NET message, because my experience is that searching on those gives more accurate results for something that could be broken in more than one environment.
Based on those:
- [Archive.is] Creating doc-lit WSDLs that “unwrap” nicely | Paul Fremantle’s Blogvia [Archive.is] Creation of proxy code from WSDL using svcutil.exe: Getting “CODEGEN: Generating message contract since…”
- Svcutil.exe issues: generates twice the same elements or generates codes that do not compile.
- Put your headers in a separate message part.
- Rename the “body” message part to “parameters”.
- Remove references to the message part in the soap:body binding. (Each of your message should have only one part. Hence, the soap:body binding will use that one.)
- [WayBack] wcf – Add Service Reference is generating Message Contracts – Stack Overflow
ReplyAction="*"
seems to be causing a lot of questions:
Some on-line tools prefer the WSDL to be in one document, but a lot of WSDL documents use import and or include features, so here are some links on that too:
- [WayBack] GitHub – lenardg/WSDLMerge: A tool to merge WSDL files (which initially did only support
wsdl:import
, but now also supportswsdl:include
) - [WayBack] Is there a simple tool to flatten a wsdl file? – Stack Overflow
- [WayBack] Is there a simple tool to flatten a wsdl file? | CODE Q&A [English]
- [WayBack] xmlHelpline.com: tools: WSDLFlattener xslt
- [WayBack] WSDLFlattener.java example
- [WayBack] c# – Using WSDL.exe with local WSDL file that has external .xsd files – Stack Overflow
Bruneau Babet correctly informed me that – though Delphi SOAP clients support both document literal and RPC encoded – Delphi SOAP servers cannot support document literal, as they can only support RPC encoded. Through that I found
- [WayBack] web services – Delphi SOAP Server – Document/Literal – Possible? – Stack Overflow.
- [WayBack] Delphi 2007: Using Web Services which has not changed since then: [WayBack] 10.2 Tokyo: Using Web Services – RAD Studio
- [WayBack] Release Notes for Delphi 2009 and C++Builder 2009 mention as part of the SOAP Server Notes:
The Win32/native SOAP server is currently on the Deprecated list and is classified as “Other Consideration: Need alternative.” If you want a document/literal server, you should build your SOAP server using Delphi for .NET (RAD Studio), which supports the SOAP specifications that are supported by the .NET framework.
- [WayBack] Release Notes for Embarcadero Delphi 2010 and C++Builder 2010 rephrase the SOAP Server Notes in terms of Delphi Prism instead of Delphi for .NET:
The Win32 SOAP server support generates the older RPC|Encoded style WebServices. If you want a document/literal service or a service of any other WS-I compliant style, you should build your SOAP server using Delphi Prism, which supports the SOAP specifications that are supported by the .NET framework, including WS-I compliant styles.
- This continued until [WayBack] Release Notes for XE3 – RAD Studio XE3, as after that [WayBack] No more Delphi for .NET: Prism removed from RAD Studio XE4 | Tim Anderson’s IT Writing. Here the SOAP Server Notes magically have disappeared from the [Archive.is] Release Notes for XE4 – RAD Studio.
- [WayBack] RPC Encoded and RPC Literal Delphi SOAP Server? – embarcadero.delphi.webservices
- [RSP-16581] WS-I Basic Profile 1.1 Compliance – Embarcadero Technologies
Unable to create a SOAP Server Application (WebService) with [WayBack] WS-I Basic Profile 1.1 compliance.
As far as I know, with delphi we can developed RPC/Encoded web services but there is no way to create Document/Literal service.
There are some companies that continue to use SOAP for information transfer, SAP one of them and we had to use C # to develop the application server.
With C# only [WayBack]
[SoapDocumentMethod]
or [WayBack][SoapRpcMethod]
is assigned to the Web Method. - I remember from the Delphi 7-2010 days that issues were raised in the private forums to press for document literal support as that is where the Java and .NET world were headed too
- A few notes on Delphi, WSDL and SOAP: passing nil values, Document/Literal versus RPC Encoded (yup: 5 years ago, I bumped into a few posts writing about this)
- [WayBack] c# – Delphi SOAP Envelope and WCF – Stack Overflow (the Delphi client side can do document/literal)
- Delphi 6 already added document literal support on the client: [WayBack] Using .NET complex types in a Delphi web service client
- Delphi 2010 added SOAP 1.2 support on the client: [WayBack] QualityCentral: Report #: 66864; Add SOAP 1.2 support to importer and clients, though people still bump into document literal issues from the client side: [WayBack] HILFE! SOAP-Client für document literal Webservice!?
- I wonder why both are still not supported on the server.
Back on those days, the big plan was to move everything Delphi to the .NET platform which supports both document literal and RPC encoded.
All in all, document literal has been on the radar with the Delphi R&D team since at least 2009, and nothing has been done.
References:
- [WayBack] SOAP Binding: Difference between Document and RPC Style Web Services
- Web Services Description Language – Wikipedia (note that despite WSDL 2.0 – which was originally named WSDL 1.2 – being out for 10+ years, most tools still only support WSDL 1.1, and some not even fully).
- [WayBack] Which style of WSDL should I use?,
[WayBack] IBM Knowledge Center – Literal vs. Encoded, RPC- vs. Document-Style[WayBack]
web services – What is the difference between Document style and RPC style communication? – Stack Overflow
[WayBack] Mike’s Software Development Blog: WSDL SOAP bindings confusion – RPC vs documentall with explanations (and some examples) of:- RPC/encoded
- RPC/literal
- Document/encoded
- Document/literal
- XSD
- WSDL 1.1
- [WayBack] Web Service Definition Language (WSDL)
- [WayBack] Web Service Definition Language (WSDL): 2.1 Document structure (which only shows
import
, but notinclude
) - [WayBack] Web Service Definition Language (WSDL): 2.3.1 Message parts
- [WayBack] Web Service Definition Language (WSDL): 2.1 Document structure (which only shows
- [WayBack] WSDL 1.1 Element Identifiers
- [WayBack] Web Service Description Usage Scenarios
- [WayBack] Web Services Description Requirements
- [WayBack] Web Service Definition Language (WSDL)
- WSDL 2.0:
- [WayBack] Web Services Description Language (WSDL) Version 2.0 Part 0: Primer
- [WayBack] Web Services Description Language (WSDL) Version 2.0 Part 1: Core Language
- [WayBack] Web Services Description Language (WSDL) Version 2.0 Part 2: Adjuncts; RPC signature definition
- [WayBack] Web Services Description Language (WSDL) Version 2.0 SOAP 1.1 Binding
- SOAP 1.1: [WayBack] Simple Object Access Protocol (SOAP) 1.1
- SOAP 1.2:
- [WayBack] Java Solution Architect: WSDL 2.0 VS WSDL 1.1
WS-I Basic Profile v1.1 provides guidance for using SOAP 1.1, WSDL 1.1, and UDDI 2.0.
WS-I Basic Profile v2.0 provides guidance for using SOAP 1.2, WSDL 1.1, UDDI 2.0, WS-Addressing, and MTOM.
- WS-I:
- [WayBack] WS-I Deliverables – Find Deliverables
- [WayBack] WS-I Basic Profile – Version 1.1 (Final)
- [WayBack] Basic Profile Version 1.1 (2006-04-10) Errata (Final)
- [WayBack] Basic Profile – Version 1.1 (Final): WSDL and Schema Import via [WayBack] web services – Importing xsd into wsdl – Stack Overflow:
wsdl:import
is for a WSDL importing another WSDL- if used, it must be in a
wsdl:definitions
element and it hasnamespace
andlocation
attributes
- if used, it must be in a
xsd:import
is for a schema in a WSDL importing an XSD having a different namespace (many sites incorrectly refer to this as “WSDL import element”)- if used, it must be in an
xsd:schema
element and it hasid
,namespace
andschemaLocation
attributes
- if used, it must be in an
xsd:include
is for a schema in a WSDL including an XSD having the same namespace- if used, it must be in an
xsd:schema
element and it hasid
andschemaLocation
attributes
- if used, it must be in an
- [WayBack] WS-I Basic Profile – Version 2.0 (Final) (which is not at www.ws-i.org/Profiles/BasicProfile-2.0.html)
- [Archive.is] WS-I Deliverables – Testing Tools
- [Archive.is] A Preview of WS-I Basic Profile 1.1
- [WayBack] Deliverables – Basic Profile 1.2
- SOAP HTTP: a SOAP Fault should always translate into a HTTP status code 500 (Internal Server error). This even holds when a different status could be more appropriate (so no “403” for Forbidden, but a SOAP Fault indicating forbidden with a status code 500:
- Via [WayBack] Webservice response HTTP statuscodes – Programming – GoT and [WayBack] SOAP Fault & HTTP Status Code » karpisek.net
- [WayBack] Simple Object Access Protocol (SOAP) 1.1: SOAP HTTP ResponseIn case of a SOAP error while processing the request, the SOAP HTTP server MUST issue an HTTP 500 “Internal Server Error” response and include a SOAP message in the response containing a SOAP Fault element (see section 4.4) indicating the SOAP processing error.
- [WayBack] Basic Profile – Version 1.0 (Final): 4.3.9 HTTP Server Error Status CodesHTTP uses the 5xx series of status codes to indicate failure due to a server error.
R1126
An INSTANCE MUST use a “500 Internal Server Error” HTTP status code if the response message is a SOAP Fault. - [WayBack] SOAP Version 1.2 Part 2: Adjuncts (Second Edition): Table 17: HTTP status code dependent transitions
- [WayBack] SOAP Version 1.2 Part 2: Adjuncts (Second Edition)Suggests that for
env:Server
, a statuscode400
is to be used, but WS-I mandates500
. - [WayBack] RFC 2616 – Hypertext Transfer Protocol — HTTP/1.1: 10.5 Server Error 5xx
- Yes it is possible to use [WayBack] java – SOAP over non-HTTP protocol – Stack Overflow, but not from Delphi, despite most of SOAP being abstracted away from the protocol.
- Via [WayBack] Webservice response HTTP statuscodes – Programming – GoT and [WayBack] SOAP Fault & HTTP Status Code » karpisek.net
- Imports in various environments:
- Uniface:
- Delphi
- [WayBack] delphi – WSDL importer generates faulty server – Stack Overflow
- [WayBack] Cannot unwrap: More than one strictly out element was found
- [WayBack] Verschillen WSDL import XE7 D10
- (from a newsgroup server that – unlike forums.embarcadero.com – did keep history)
[WayBack] WSDL – Cannot Unwrap issues / on embarcadero.public.delphi.webservices / NNTP Conversation
with the below thread messages covering many topics:- “Cannot unwrap” hint comments in Delphi generated WSDL import code
- WS-addressing (needs manual implementation)
- rpc-encoded versus document-literal
- wrapped document-literal to make using document-literal easier to use than the bare document-literal ones
- Passing SOAP headers from Delphi and C# (see also [WayBack] Defining and Using SOAP Headers)
- Inspecting SOAP request output in the RIO using the OnBeforeExecute event
- The WSDL used in the thread:
- [cannot be archived] tapstaging.tax.utah.gov/efile/MFET/WSDL/?wsdl
- [cannot be archived] tapstaging.tax.utah.gov/efile/MFET/WSDL/?wsdl=wsdl0
- [WayBack] tax.utah.gov/fuel/handbook.pdf
- [WayBack] Article 1649 Subject WSDL – Cannot Unwrap issues on embarcadero.public.delphi.webservices
- [WayBack] Article 1650 Subject Re: WSDL – Cannot Unwrap issues on embarcadero.public.delphi.webservices
- [WayBack] Article 1653 Subject Re: WSDL – Cannot Unwrap issues on embarcadero.public.delphi.webservices
- [WayBack] Article 1657 Subject Re: WSDL – Cannot Unwrap issues [Edit] on embarcadero.public.delphi.webservices
- [WayBack] Article 1665 Subject Re: WSDL – Cannot Unwrap issues [Edit] on embarcadero.public.delphi.webservices
- [WayBack] Article 1667 Subject Re: WSDL – Cannot Unwrap issues on embarcadero.public.delphi.webservices
I looks like a wsdl message
request part
entries need to be named parameters
for some tooling to correctly infer document/literal in a wrapped way. Some links for further research on this:
- wrapper “wsdl:part name=” “parameters” – Google Search and wrapper “wsdl:part name=”parameters” – Google Search
- [WayBack] WSDL Reading, a Beginner’s Guide
- [WayBack] schema – What is the difference between Type and Element in WSDL? – Stack Overflow
Note how the word “wrapped” does not appear. What IBM in their document is calling “document/literal/wrapped” is simply “document/literal”, that happens to use a single message part, that happens to have a name derived from the name of the service, and that happens to refer to an element, and which happens to contain both the parameters to the operation.
- [WayBack] WSDL 1.1 Binding Extension for SOAP 1.2
- IBM: [WayBack] Which style of WSDL should I use? and [WayBack] Tip: Implement implicit and explicit SOAP headers
- [WayBack] WSDL and Service Contracts | Microsoft Docs
- [WayBack] Modifying auto generated .net’s WSDL to take actual types instead of wrapper elements?
- [WayBack] strong-soap/doc_literal_wrapped_test.wsdl at master · strongloop/strong-soap · GitHub
- [WayBack] Utilities- Interoperability gotcha in wsdl.exe tool – Keep it Simple
When you are surely running SOAP over HTTP, you can use this small class to raise exceptions which automatically get translated into SOAP Faults having the right return code using a trick I bumped into a few years ago from [WayBack] web services – Accessing the original TWebRequest object in a Delphi SOAP Server – Stack Overflow:
unit SoapFaultWithHttpCodeExceptionUnit; interface uses System.SysUtils; type ESoapFaultWithHttpCodeException = class(Exception) strict private FHttpStatusCode: Integer; public constructor Create(const AHttpStatusCode: Integer); property HttpStatusCode: Integer read FHttpStatusCode; end; implementation uses Winapi.WinHTTP, Soap.WebBrokerSOAP, Web.HTTPApp, IdCustomHTTPServer; constructor ESoapFaultWithHttpCodeException.Create(const AHttpStatusCode: Integer); var IdHTTPResponseInfo: TIdHTTPResponseInfo; ReasonString: string; WebDispatcher: IWebDispatcherAccess; begin IdHTTPResponseInfo := TIdHTTPResponseInfo.Create(nil, nil, nil); try FHttpStatusCode := AHttpStatusCode; IdHTTPResponseInfo.ResponseNo := AHttpStatusCode; ReasonString := Format('%d: %s', [AHttpStatusCode, IdHTTPResponseInfo.ResponseText]); inherited Create(ReasonString); // https://stackoverflow.com/questions/10405227/accessing-the-original-twebrequest-object-in-a-delphi-soap-server if Supports(GetSOAPWebModule, IWebDispatcherAccess, WebDispatcher) then begin WebDispatcher.Response.StatusCode := HTTP_STATUS_SERVER_ERROR; WebDispatcher.Response.ReasonString := ReasonString; end finally IdHTTPResponseInfo.Free; end; end; end.
—jeroen
WSDL 1.1 versus 2.0 diagram
Source: Web Services Description Language – Wikipedia