wsdl.exe does not support mime:mimeXml as input encoding?

A

andy.malakov

Hello All,

I am trying to generate .NET proxies for web service that uses HTTP
POST binding (note: not SOAP!). Web Service exposes single operation
that accepts some XML as input and output (specified as base xsd type).

Problem is that wsdl.exe does not allow using mime:mimeXml encoding as
operation inputs.

http://www.w3.org/TR/wsdl.html#_mime:mimeXml

Here is WSDL fragment that causes this problem:

<binding name="GatewayBindingHttpPost" type="tns:GatewayPort">
<http:binding verb="POST"/>
<operation name="process">
<http:eek:peration location="/process"/>
<input>
<mime:mimeXml part="request"/>
</input>
<output>
<mime:mimeXml part="response"/>
</output>
</operation>
</binding>

Exact warning that wsdl.exe generates:

// CODEGEN: The operation 'process' from namespace ... was ignored. No
input MIME formats were recognized.

I cannot find any confirmation to this limitation on MSDN. Can somebody
please confirm/advise on this problem?

P.S. Changing input type to 'application/x-www-form-urlencoded'
makes wsdl.exe happy.
 
D

Dan Rogers

Hi,

No. WSDL.exe only supports a subset of types defined in XML schema. If
you've found a work-around for your binding settings that works for you,
that's good information.

Regards

Dan Rogers
Microsoft Corporation
--------------------
 
A

AndyMalakov

Thank you Dan,
WSDL.exe only supports a subset of types defined in XML schema.

I am not sure if I made myself clear.

1. I do not see in WSDL specification anything that restricts use of
mime:mimeXml to specify schema of input element for HTTP POST based
operation.

2. Microsoft WSDL.EXE does allow me to use mime:mimeXml to describe
operation *output* and generates correct proxies for my service and all
XML messages declared in WSDL document.

3. Problem only arises when I try to use mimeXml to describe operation
input. In that case WSDL.EXE complains:

"Warning: one or more operations were skipped.
Warnings were encountered. Review generated source comments for more
details."

Generated source has the following comment:

"// CODEGEN: The operation 'process' from namespace '...' was ignored.
No input MIME formats were recognized."

I do have a workaround, which is wrapping XML messages in SOAP
envelopes, but I would prefer not to.
Thank you again very much for your help,
Andy
 
D

Dan Rogers

Hi Andy,

Thanks for this very clear feedback. I'll relay it to the right group -
who is busy with the 2.0 version now...

Best regards

Dan Rogers
Microsoft Corporation
--------------------
 
D

Dan Rogers

Hi Andy,

One more question... just looking again at your last line. If you are
wrapping XML messages in SOAP envelopes, I'm not sure why you're specifying
MimeXML in the first place. When I build services, they end up as XML
wrapped in SOAP envelopes, and I never have to touch either XML or my WSDL
file to do so. Is this some special third party compatibility issue where
they are trying to use MimeXML versus just plain old W3C XML?

Dan


--------------------
 
A

AndyMalakov

Dan,

For multiple reasons we would like to avoid using SOAP binding for our
service in favor of HTTP POST.

Thanks,
Andy
 
D

Dan Rogers

Hi Andy,

The SOAP specificaiton clearly calls out the requirements for HTTP Post
binding, and the WSDL 1.1 specification also defines this protocol in
detail. Our tooling does provide support for HTTP post of XML documents.
It apears that the only issue you are facing is the text to put in your
hand-coded WSDL file.

I've sent a question on this to our serializer team - they are also
responsible for the ASP.net service runtime logic - so I'll be back when I
get an answer to this. However, I suggest you reference the WSDL and SOAP
specs for HTTP post binding - as I'm not sure where you've come across this
MIME makup as the only way to do it.

Regards

Dan Rogers
Microsoft Corporation
--------------------
 
A

AndyMalakov

Hello Dan,

Thank you very much for your help.

Dan, I am not interested in SOAP 1.1 HTTP binding. I am asking about
plain XML web-service that uses HTTP as described in Chapter 4 of WSDL
specification: http://w3.org/TR/wsdl.html#_http

Here is how WSDL looks like:

<http:binding verb="POST"/>
<operation name="process">
<http:eek:peration location="process"/>
<input>
<mimeXml part="address"/>
</input>
<output>
....
</output>
From what I can see namespace System.Web.Services.Protocols does not
contain implementation for something like XmlParameterWriter. Which
could be something like this:

(Note: stripped methods like GetInitializer/Initialize/
UsesWriteRequest)


public class XmlRequestWriter : MimeParameterWriter {
__
__public override void InitializeRequest(
____WebRequest request,
____object[] values)
__{
____request.ContentType = "text/xml; charset=utf-8";
__}
__
__public override void WriteRequest(
____Stream requestStream,
____object[] values)
__{
____if (values.Length != 1)
______throw new ArgumentException ("this is only example");
____
____mSerializer.Serialize(requestStream, values [0]);
__}
__
}


All the Best,
Andy
 
D

Dan Rogers

Hi Andy,

From what I can see, I'm not sure what value add you are getting by writing
your own serializer (I think you're calling this a parameter writer). Are
you trying to get either SOAP RPC encoding or Document Literal on the wire?
Or are you just trying to get the HTTP header to indicate that POST is
being used versus SOAP.

If the latter, you can write your own SOAP post handler - the XML DOM or
the WebRequest objects will let you specify and control your own HTTP
headers, and then you can use the standard XML serialization to populate
the body of your web request (you'll have to serialize into the HTTP stream
or build the entire request in a memory stream, rewind the stream, and then
POST it via your WebRequest object.

Is this WSDL for a service you are writing? Did you know that if you build
a servide with VS, even though the WSDL will say it is using a SOAP
binding, by default it builds the infrastructure to handle HTTP Post and
HTTP Get processing as well?

Dan

--------------------
From: "AndyMalakov" <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
Subject: Re: wsdl.exe does not support mime:mimeXml as input encoding?
Date: 21 Dec 2004 08:07:01 -0800
Organization: http://groups.google.com
Lines: 54
Message-ID: <[email protected]>
References: <[email protected]>
<[email protected]>
<[email protected]>
NNTP-Posting-Host: 141.154.102.2
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1103645227 27119 127.0.0.1 (21 Dec 2004 16:07:07 GMT)
X-Complaints-To: (e-mail address removed)
NNTP-Posting-Date: Tue, 21 Dec 2004 16:07:07 +0000 (UTC)
User-Agent: G2/0.2
Complaints-To: (e-mail address removed)
Injection-Info: c13g2000cwb.googlegroups.com; posting-host=141.154.102.2;
posting-account=Gl24Kg0AAACpAZ3QU2RCJlCf9jqNF8LK
Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXS01.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08
phx.gbl!news-out.cwix.com!newsfeed.cwix.com!border1.nntp.dca.giganews.com!n
ntp.giganews.com!news.glorb.com!postnews.google.com!c13g2000cwb.googlegroups
com!not-for-mail
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.aspnet.webservices:27326
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices

Hello Dan,

Thank you very much for your help.

Dan, I am not interested in SOAP 1.1 HTTP binding. I am asking about
plain XML web-service that uses HTTP as described in Chapter 4 of WSDL
specification: http://w3.org/TR/wsdl.html#_http

Here is how WSDL looks like:

<http:binding verb="POST"/>
<operation name="process">
<http:eek:peration location="process"/>
<input>
<mimeXml part="address"/>
</input>
<output>
...
</output>
From what I can see namespace System.Web.Services.Protocols does not
contain implementation for something like XmlParameterWriter. Which
could be something like this:

(Note: stripped methods like GetInitializer/Initialize/
UsesWriteRequest)


public class XmlRequestWriter : MimeParameterWriter {
__
__public override void InitializeRequest(
____WebRequest request,
____object[] values)
__{
____request.ContentType = "text/xml; charset=utf-8";
__}
__
__public override void WriteRequest(
____Stream requestStream,
____object[] values)
__{
____if (values.Length != 1)
______throw new ArgumentException ("this is only example");
____
____mSerializer.Serialize(requestStream, values [0]);
__}
__
}


All the Best,
Andy
 
A

AndyMalakov

Hello Dan,

"On the wire" I would like to see XML messages *without* SOAP
envelope. We have message-oriented service implemented on J2EE
platform. All messages are in XML format and documented using XSD. We
want to provide access for .NET clients with minimum overhead. (In this
particular case, SOAP is overhead).

I used above XmlRequestWriter to patch auto-generated proxy:

[HttpMethodAttribute(typeof(XmlReturnReader),typeof(XmlRequestWriter))]
public ResponseMessage process(RequestMessage request)

It seems to be enough for simple support of mimeXml input binding in
..NET. May be there is a better way (I am .NET newbie).

Looks like what we want is similar to REST approach. I found
confirmation to the problem described in this thread on Paul
Prescot's website (he is REST advocate):
http://www.prescod.net/rest/wsdlhttp.html

Thanks,
Andy
 
D

Dan Rogers

Hi Andy,

If you want to avoid the SOAP processing, then I'm afraid I'm not going to
be able to help you. The entire ASP.net and .NET framework processing
stack, from now into the forseeable future is heavily invested in and
completely bound to SOAP compliant implementations.

For pure XML slinging, the DOM is the way I'd go. There really isn't any
tool support (e.g. wizards, proxy generators, etc) in visual studio to
support this approach - the # of issues associated with every endpoint
rolling their own protocol layer is just astounding (thus the tool market
convergence around SOAP) - but you can use raw XML, and drive serialization
manually. Of course, the proxy class generators aren't going to be of any
use to you at all.

Good luck

Dan Rogers
Microsoft Corporation
--------------------
From: "AndyMalakov" <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
Subject: Re: wsdl.exe does not support mime:mimeXml as input encoding?
Date: 22 Dec 2004 16:17:21 -0800
Organization: http://groups.google.com
Lines: 24
Message-ID: <[email protected]>
References: <[email protected]>
<[email protected]>
<[email protected]>
NNTP-Posting-Host: 141.154.102.2
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1103761078 17175 127.0.0.1 (23 Dec 2004 00:17:58 GMT)
X-Complaints-To: (e-mail address removed)
NNTP-Posting-Date: Thu, 23 Dec 2004 00:17:58 +0000 (UTC)
User-Agent: G2/0.2
Complaints-To: (e-mail address removed)
Injection-Info: z14g2000cwz.googlegroups.com; posting-host=141.154.102.2;
posting-account=Gl24Kg0AAACpAZ3QU2RCJlCf9jqNF8LK
Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!news-out.cwi
x.com!newsfeed.cwix.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news
.glorb.com!postnews.google.com!z14g2000cwz.googlegroups.com!not-for-mail
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.aspnet.webservices:27366
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices

Hello Dan,

"On the wire" I would like to see XML messages *without* SOAP
envelope. We have message-oriented service implemented on J2EE
platform. All messages are in XML format and documented using XSD. We
want to provide access for .NET clients with minimum overhead. (In this
particular case, SOAP is overhead).

I used above XmlRequestWriter to patch auto-generated proxy:

[HttpMethodAttribute(typeof(XmlReturnReader),typeof(XmlRequestWriter))]
public ResponseMessage process(RequestMessage request)

It seems to be enough for simple support of mimeXml input binding in
.NET. May be there is a better way (I am .NET newbie).

Looks like what we want is similar to REST approach. I found
confirmation to the problem described in this thread on Paul
Prescot's website (he is REST advocate):
http://www.prescod.net/rest/wsdlhttp.html

Thanks,
Andy
 
A

AndyMalakov

Thank you Dan,

One may argue that message-oriented services that use literal encoding
do not really need SOAP. The only missing piece is few extra
implementations of MimeParameterWriter / MimeResultReader that support
common mime types.

All the Best,
Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,142
Latest member
DewittMill
Top