473,667 Members | 2,749 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="MyRequest Msg">
<wsdl:part name="myData" element="req:my Data"/>
</wsdl:message>

The schema defines req:myData element as below:

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

<xs:complexTy pe name="MyData">
<xs:sequence>
<xs:element name="counter" type="xs:intege r"/>
<xs:element name="message" type="xs:string "/>
</xs:sequence>
</xs:complexType>
<xs:element name="myData" type="rec:MyDat a"/>
</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="MyService Interface">
<http:binding verb="GET"/>
<wsdl:operati on name="MyOperati on">
<http:operati on location="MyOpe ration.aspx"/>
<wsdl:input>
<http:urlEncode d/>
</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>He llo World</rec:message>
</rec:myData>

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

..../MyOperation.asp x?counter=22&me ssage=Hello+Wor ld

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="MyRequest Msg">
<wsdl:part name="time" element="req:wh atever-willBeIgnoredAn yway"/>
<wsdl:part name="message" element="req:wh atever-willBeIgnoredAn yway"/>
</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 2041
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 XmlRootAttribut e, XmlElementAttri bute and
if you need to use XML attributes on the wire, XmlAttributeAtt ribute. 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.ex e. These tools automatically
put in the proper Xml*Attribute logic.

I hope this helps

Dan Rogers
Microsoft Corporation
--------------------
From: "yuri" <yu****@cablesp eed.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.B 161DF70"
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.publi c.dotnet.framew ork.webservices
NNTP-Posting-Host: c66-235-38-219.sea2.cables peed.com 66.235.38.219
Path:
cpmsftngxa10.ph x.gbl!TK2MSFTFE ED01.phx.gbl!TK 2MSFTNGP08.phx. gbl!TK2MSFTNGP1 5
.phx.gbl
Xref: cpmsftngxa10.ph x.gbl
microsoft.publi c.dotnet.framew ork.webservices :7284
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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="MyRequest Msg">
<wsdl:part name="myData" element="req:my Data"/>
</wsdl:message>
The schema defines req:myData element as below:
<xs:schema
targetNamespace ="http://www.mysample.or g/requests/"
elementFormDefa ult="qualified"
xmlns:rec="http ://www.mysample.or g/requests/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"

<xs:complexTy pe name="MyData">
<xs:sequence>
<xs:element name="counter" type="xs:intege r"/>
<xs:element name="message" type="xs:string "/>
</xs:sequence>
</xs:complexType>
<xs:element name="myData" type="rec:MyDat a"/>
</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="MyService Interface">
<http:binding verb="GET"/>
<wsdl:operati on name="MyOperati on">
<http:operati on location="MyOpe ration.aspx"/>
<wsdl:input>
<http:urlEncode d/>
</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>He llo World</rec:message>
</rec:myData>
then I would like to flatten it so it is mapped to a url-encoded string as
below:
.../MyOperation.asp x?counter=22&me ssage=Hello+Wor ld
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="MyRequest Msg">
<wsdl:part name="time" element="req:wh atever-willBeIgnoredAn yway"/>
<wsdl:part name="message" element="req:wh atever-willBeIgnoredAn yway"/>
</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
5874
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 complex mapping rules, XSLT stuff or XML query languages. The XML should be mapped automatically to tables. It might be nice, but its not necessery, to do it the other way round. Does anyone knows tools (phpscripts) to do this?
10
2041
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
1615
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 those"--"those" representing, among others, O/R mapping). Probably I'm missing something really obvious, but a google search only gave me commercial O/R mapping tool! Is there any free O/R mapping tool that comes with .NET? Elder
3
2663
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 proxy file I end up with two ..NET classes, one called Name and the other called Name1. The Name1 class has the appropriate attributes to serialise the content to an element called name with the correct xml namespace. The wsdl2java tool that...
4
1763
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 but I have one problem.. I am not able to read a Complex Content.. Here is a portion of the XSD that contains the complex content. I need to read the elements under it and could not get an handle to it.. Could you please help?
1
2557
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 emps - 1 for manager and the second for workers (Collection). How can I map this? We can add additional fields in the emp table that indicates the property in the depts?
1
1353
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 servlet-mapping? i thank you.
3
1515
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 xmlns="http://www.fixprotocol.org/FIXML-4-4"> <Order Acct="1" ExDest="ExchDest"> <Hdr Snt="2007-04-05T13:34:47"/>
0
1638
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 using the custom type "requiredstring" defined as: <xs:simpleType name="requiredstring"> <xs:restriction base="xs:string">
2
4895
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, then write the whole thing back out? thanks - dave david@at-at-at@windward.dot.dot.net
0
8366
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8888
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8790
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8565
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
4202
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2779
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1779
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.