Solved

SOAPs WSDLs and DataTypes

Posted on 2007-03-23
16
532 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
ID: 18783010
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
ID: 18784010
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
ID: 18784151
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:ezekial316
ID: 18785013
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:
Mayank S earned 500 total points
ID: 18785783
>> 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
ID: 18787839
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:Mayank S
ID: 18788935
>>  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
ID: 18789080
>> 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
 
LVL 30

Expert Comment

by:Mayank S
ID: 18789089
Probably you have an older reference. try regenerating the proxy using wsdl.exe
0
 

Author Comment

by:ezekial316
ID: 18789399
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:Mayank S
ID: 18789650
Ok - try with the new proxy class.
0
 

Author Comment

by:ezekial316
ID: 18792919
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
ID: 18792954
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
ID: 18793950
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
ID: 18794349
What I meant about wasting your time was 'Call bill on this...'
0
 

Author Comment

by:ezekial316
ID: 18795138
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
java example issue 5 42
program arguments vs VM arguments 4 25
asp.net figure out error 3 20
c#, case, if 4 16
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
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 …

685 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