Solved

SOAPs WSDLs and DataTypes

Posted on 2007-03-23
16
523 Views
Last Modified: 2013-11-18
I have a client that has created a bunch of SOAP services via a JBOS thingymagig (i know nothing of java and hopefully it will stay that way).  They have a very strange environment which they built themselves, including the programming language - its based on java i believe.

Anyways, i have to connect to their webservices, via their WSDLs, and most paramters are string, with a couple of exceptions being booleans.

The strings however are strange, as in the reference file i have the following SOAP property declarations:

<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="integer")>  _
        Public Property pWithChangedNameToHide() As String

the attribute says its a datatype of integer, but the property says its a string.

Is it correct that i should be able to send them a integer natively without changing it to a string?  Or can SOAP requests only handle strings and booleans?

Thanks for any help as i know nothing of SOAP and Java environments.

Colin
0
Comment
Question by:ezekial316
  • 8
  • 4
  • 4
16 Comments
 
LVL 6

Expert Comment

by:SamsonChung
Comment Utility
I believe only integer would do the trick.

what that indicates seems to be a function in the code that is defined as String, it could be something internal.

I haven't been playing with WSDL enough to really help a lot, but my suggestions is that you try native Integer first... depending on your language of preferences... and if that fails try String.

but I believe that the system, if written correctly should take both.
0
 

Author Comment

by:ezekial316
Comment Utility
Unfortunately what i have as an example up there is a property and not a method.  So the property expects a string.  I know with Visual Basic that its not a problem, its "nice" with these things, but this project is one that will go on for years and might be translated into C# at some point (more than likey as the company that will develop things further work in C# while my company works in VB) and C# is more unforgiving.

So what you are saying if the WSDLs have been compiled correctly then then it should accept integers natively.  Makes me wonder if its there side or myside when i reference the WSDLs.

Its given me some thoughts and thank you but if someone else knows a fuller answer that will be helpful.

0
 
LVL 6

Expert Comment

by:SamsonChung
Comment Utility
C# is just MS' Version of Java.....

so if I were you, I would start to consider learning one or the other.

of coz, there would be some differences... like C#'s optimized on Windows, while Java is not. and C# is ONLY optimized for Windows while Java is not.... did I sound like I repeated myself?

VB eh? I just heard that VB.net removed control Source from VB6.... I took so much advantage of that when I was using VB.... now, it nearly helped made my mind of never going back to VB.net unless otherwise forced to.

Anyways, on the subject of your matter, I am sorry  I can't help you more. The last time I played with WSDL was back in University. And I only remembered how to read it. :p
0
 

Author Comment

by:ezekial316
Comment Utility
I know C# very well, its just my current company use VB.net.  To say you would only use VB.net if forced is a bit silly as the differences between C# and VB.net are only syntax and both can do what the other can do.  And as they are both compiled by the CLR (or whatever it is) they both run nearly exactly the same...but thts off the question as well :-)

THanks though
0
 
LVL 30

Accepted Solution

by:
mayankeagle earned 500 total points
Comment Utility
>> Anyways, i have to connect to their webservices, via their WSDLs,

Is your client written in Java or .NET?

If it is in Java, use the WSDL2Java tool to convert the WSDL to a Java proxy class. If .NET use the wsdl.exe tool provided by M$ to convert the WSDL to a .NET class (C# or VB). Then use the proxy class to access the web service methods and it will take care of serialization/ deserialization and the SOAP stuff for you.

http://ws.apache.org/axis/java/user-guide.html

http://ws.apache.org/axis/java/reference.html

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptools/html/cpgrfwebservicesdescriptionlanguagetoolwsdlexe.asp
0
 

Author Comment

by:ezekial316
Comment Utility
Its in .net, and that last link is interesting.  Will look into it.

So what its kinda saying is when i create a webreference in Visual Studio 2005, it doesn't really do the wsdl justice...you need to do more to be able to use the WSDL correctly and work with the native data types instead of having to convert things into strings.  But saying that this "proxy" class does all the coversion for me, so really only adds an extra layer of complexity.

Still going to try it out and see what difference it makes overall, if any.

Thanks for the links.
0
 
LVL 30

Expert Comment

by:mayankeagle
Comment Utility
>>  But saying that this "proxy" class does all the coversion for me, so really only adds an extra layer of complexity.

No, it adds a layer of simplicity because it hides the serialization/ de-serialization and SOAP stuff from you.

>> i create a webreference in Visual Studio 2005, it doesn't really do the wsdl justice

Web-references also internally generate a proxy class - just that you don't see it.
0
 

Author Comment

by:ezekial316
Comment Utility
>> Web-references also internally generate a proxy class - just that you don't see it.

Ok so thats what i happening at the moment, as i don't do any de/serialization.  just seems every property exposed is either string or boolean and nothing else.  while some of the wsdl descriptions says its an data type of integer.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 30

Expert Comment

by:mayankeagle
Comment Utility
Probably you have an older reference. try regenerating the proxy using wsdl.exe
0
 

Author Comment

by:ezekial316
Comment Utility
Yeah i do that on a weekly basis...the client sends us the new WSDLs and i regenerate through the "Update Web Reference" option in visual studio.

Am just confused that the property says String, but the attribute says its an Integer.

I won't know till i am in work tomorrow so will keep you posted.
0
 
LVL 30

Expert Comment

by:mayankeagle
Comment Utility
Ok - try with the new proxy class.
0
 

Author Comment

by:ezekial316
Comment Utility
Ok i found the answer!! And its a weird one!!  But i think i have the answer to it.

The company producing the web service, are using a Java based system.  So when they create the wsdl file they are using xsd:integer, as the integer type, and thats fair enough.  But i bet your all thinking...and?...well i did a quick test and found out that, using the wsdl.exe or even the add/update web reference supplied by microsoft it doesn't like xsd:integer.  I thought maybe its a capitalisation things, as they could be using c# or c++ as the tool.  The schema didn't like it, although it does like xsd:integer, its the wsdl.exe tool that doesn't seem to like it.

I then did 1 final test, the reason it was final was because it worked, by changing the xsd:integer to xsd: int, within one of the wsdl files.  I then ran it through the wsdl.exe tool again, and bingo!! I had properties with integer as the type.  Go figure.

although i never got the full answer from mayankeagle, am still awarding you the points as started me down the correct route.

thanks, wonder if i should call bill on this bug/error/problem
0
 
LVL 6

Expert Comment

by:SamsonChung
Comment Utility
ezekial,

Don't waste your time.

If this is the case, it is most likely intentional.

Or, what you can also do, is, define a new class call Integer and have it extends your current langauge's int.
0
 

Author Comment

by:ezekial316
Comment Utility
What i did was find and replace on the wsdl...and then imported it again :-)  Worked a treat.
0
 
LVL 6

Expert Comment

by:SamsonChung
Comment Utility
What I meant about wasting your time was 'Call bill on this...'
0
 

Author Comment

by:ezekial316
Comment Utility
And what i was talking about was:

>> Or, what you can also do, is, define a new class call Integer and have it extends your current langauge's int.

which seems a bit of over kill to do a find and replace.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now