473,395 Members | 2,151 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Mapping complex elements to url-encoded strings

Hello,

Is it possible to create a binding that would map an input message with a part defined as a complex-type element to a url-encoded string?

For example, wsdl file defines a message as

<wsdl:message name="MyRequestMsg">
<wsdl:part name="myData" element="req:myData"/>
</wsdl:message>

The schema defines req:myData element as below:

<xs:schema
targetNamespace="http://www.mysample.org/requests/"
elementFormDefault="qualified"
xmlns:rec="http://www.mysample.org/requests/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"

<xs:complexType name="MyData">
<xs:sequence>
<xs:element name="counter" type="xs:integer"/>
<xs:element name="message" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="myData" type="rec:MyData"/>
</xs:schema>

I would like to bind this message to a service that accepts traditional url-encoded HTTP GET requests:

<wsdl:binding name="MyService" type="MyServiceInterface">
<http:binding verb="GET"/>
<wsdl:operation name="MyOperation">
<http:operation location="MyOperation.aspx"/>
<wsdl:input>
<http:urlEncoded/>
</wsdl:input>
<wsdl:output>
<mime:mimeXml/>
</wsdl:output>
</wsdl:operation>

Specifically, if I have an element

<rec:myData>
<rec:counter>22</rec:counter>
<rec:message>Hello World</rec:message>
</rec:myData>

then I would like to flatten it so it is mapped to a url-encoded string as below:

..../MyOperation.aspx?counter=22&message=Hello+World

So far I was not able to do this. Moreover, I found that wsdl.exe from ..NET framework v 1.1.4322.573 ignores element attribute in a message part. The only way I was able to pass multiple parameters to the generated stub is by defining a multi-part message:

<wsdl:message name="MyRequestMsg">
<wsdl:part name="time" element="req:whatever-willBeIgnoredAnyway"/>
<wsdl:part name="message" element="req:whatever-willBeIgnoredAnyway"/>
</wsdl:message>

Am I doing something wrong or is it just wsdl 1.1 that does not allow binding the same port types to the services with different protocols?

Thanks,
Yuri

Nov 21 '05 #1
1 2005
Hi Yuri,

Unless you manually do this encoding (say for invoking via the HTTP Get
binding), then no, you don't need to UrlEncode this data. If you did, it
would fail serializaiton, since the WSDL you showed expects an Xml element
to show up, and this is not the same thing as a UrlEncoded string.

One thing to consider (other than defining your methods as loosley coupled
by making the parms XmlNode's) is to create classes that represent this
data, and use those classes as your parm types. You can hand code these,
and attribute them properly with XmlRootAttribute, XmlElementAttribute and
if you need to use XML attributes on the wire, XmlAttributeAttribute. The
reason you might need to attribute your data classes is to get the correct
XML namespace association with the class metadata.

An easy way to do this as well is to generate the code for your data
classes with either Xsd.EXE or XsdObjectGen.exe. These tools automatically
put in the proper Xml*Attribute logic.

I hope this helps

Dan Rogers
Microsoft Corporation
--------------------
From: "yuri" <yu****@cablespeed.com>
Subject: Mapping complex elements to url-encoded strings
Date: Sun, 7 Nov 2004 01:54:18 -0800
Lines: 220
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_0008_01C4C46C.B161DF70"
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <O3**************@TK2MSFTNGP15.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.webservices
NNTP-Posting-Host: c66-235-38-219.sea2.cablespeed.com 66.235.38.219
Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFT NGP08.phx.gbl!TK2MSFTNGP15
.phx.gbl
Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.webservices:7284
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices

Hello,
Is it possible to create a binding that would map an input message with a
part defined as a complex-type element to a url-encoded string?
For example, wsdl file defines a message as
<wsdl:message name="MyRequestMsg">
<wsdl:part name="myData" element="req:myData"/>
</wsdl:message>
The schema defines req:myData element as below:
<xs:schema
targetNamespace="http://www.mysample.org/requests/"
elementFormDefault="qualified"
xmlns:rec="http://www.mysample.org/requests/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"

<xs:complexType name="MyData">
<xs:sequence>
<xs:element name="counter" type="xs:integer"/>
<xs:element name="message" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="myData" type="rec:MyData"/>
</xs:schema>
I would like to bind this message to a service that accepts traditional
url-encoded HTTP GET requests:
<wsdl:binding name="MyService" type="MyServiceInterface">
<http:binding verb="GET"/>
<wsdl:operation name="MyOperation">
<http:operation location="MyOperation.aspx"/>
<wsdl:input>
<http:urlEncoded/>
</wsdl:input>
<wsdl:output>
<mime:mimeXml/>
</wsdl:output>
</wsdl:operation>
Specifically, if I have an element
<rec:myData>
<rec:counter>22</rec:counter>
<rec:message>Hello World</rec:message>
</rec:myData>
then I would like to flatten it so it is mapped to a url-encoded string as
below:
.../MyOperation.aspx?counter=22&message=Hello+World
So far I was not able to do this. Moreover, I found that wsdl.exe from
.NET framework v 1.1.4322.573 ignores element attribute in a message part.
The only way I was able to pass multiple parameters to the generated stub
is by defining a multi-part message:
<wsdl:message name="MyRequestMsg">
<wsdl:part name="time" element="req:whatever-willBeIgnoredAnyway"/>
<wsdl:part name="message" element="req:whatever-willBeIgnoredAnyway"/>
</wsdl:message>
Am I doing something wrong or is it just wsdl 1.1 that does not allow
binding the same port types to the services with different protocols?
Thanks,
Yuri

Nov 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Leo Heber | last post by:
Hello, I need a tool (preferable in PHP to run on every webserver or very easily accecable by PHP) which can convert data from XML to a relational DBS (MySQL). I donnot want to stick around with...
10
by: mike | last post by:
regards: Where to find tag mapping-table of HTML translated to XHTML1.0 Any positive suggestion is welcome. thank you May goodness be with you all
3
by: Elder Hyde | last post by:
I was reading this interview with Hejlsberg, when suddenly the conversation turned to O/R mapping. Hejlsberg talked as if he had had to design an O/R mapping for .NET (he said ".NET had each one of...
3
by: ripster | last post by:
Hi, I am working on a project which has a wsdl file which contains two elements (lets call then the Name element) with same name but under different targetNamespaces. When I generate the client...
4
by: Ganesh Muthuvelu | last post by:
Hi STAN, Stan: Thanks for your response to my previous post on reading a XSD file using your article in "https://blogs.msdn.com/stan_kitsis/archive/2005/08/06/448572.aspx". it works quite well...
1
by: Ram | last post by:
Hey, I'm having a trouble mapping a connecting between 2 of my tables. We have 2 tables - the simplest "dept", "emp" tables which are mapped to 2 classes. Class Dept contains 2 properties for...
1
by: pbd22 | last post by:
using web.xml in java, you can map a friendly url to an unfriendly string such as "?processMaster=343-234-23423-2342&processId=144". does anybody know if there is an ASP.NET compliment to...
3
by: luthriaajay | last post by:
I have a query regarding mapping of 2 different namespace elements : 1).I get the undermentioned XML data from a system: <?xml version="1.0" encoding="UTF-8"?> <FIXML...
0
by: sayor | last post by:
Hi, I am writing a schema to check for empty elements in an XML file. I am able to do so for simple elements such as: <xs:element name="authorname" type ="requiredstring"></xs:element> by...
2
by: David Thielen | last post by:
Hi; I have a small XML file that I need to read/change from my app. Is there some easy way to map from XML to my objects so I can just read it in to my objects, change the objects as needed,...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.