66020 members! Sign up to stay informed.

Sponsored Links


Resources

.NET Research Library
Get .NET related white papers, case studies and webcasts

XML & Web services XML & Web services XML & Web services Messages: 17 Messages: 17 Messages: 17 Printer friendly Printer friendly Printer friendly Post reply Post reply Post reply XML XML XML

WSDL Code Generation

Posted by: Bruce Ingalls on December 02, 2004 DIGG
I am running SOAP based web services on an Unix platform, using Apache/Axis. (See also Linux/SOAP forum)
It's wsdl2java and wsdl2c[++] work fine, so far.

However, there is a bug in Microsoft .NET's wsdl.exe code generator; it cannot generate proper C# code for multidimensional arrays, or arrays of complex types (structs).
I've not yet tried PocketSOAP, which generates code for VB and C++, but not C#.
Does anyone know of a WSDL to C# generator, other than Microsoft's wsdl.exe?
Altova XML Spy generates C# code from DTD and XML/Schema, but not from WSDL.

Threaded replies

·  WSDL Code Generation by Bruce Ingalls on Thu Dec 02 10:27:09 EST 2004
  ·  URL? by Christian Weyer on Thu Dec 02 13:11:16 EST 2004
    ·  WSDL URN by Bruce Ingalls on Fri Dec 03 10:03:18 EST 2004
      ·  Huh? by Christian Weyer on Fri Dec 03 13:59:33 EST 2004
        ·  Example WSDL by Bruce Ingalls on Mon Dec 06 20:51:40 EST 2004
          ·  WSCF 0.4 by Christian Weyer on Tue Dec 07 09:28:07 EST 2004
            ·  follow up by Bruce Ingalls on Thu Jan 06 12:25:27 EST 2005
              ·  Did you resolve this? by Murali Inguva on Wed Feb 09 19:29:15 EST 2005
                ·  Did you resolve this? by Bruce Ingalls on Thu Feb 10 14:40:51 EST 2005
                  ·  Thank you for the reply by Murali Inguva on Sat Feb 12 20:36:50 EST 2005
                    ·  Not true by Dino Chiesa on Fri Mar 11 00:37:25 EST 2005
                      ·  An update by Dino Chiesa on Fri Mar 11 11:12:54 EST 2005
                        ·  Can you help ? by Zsolt h on Wed Apr 13 15:55:09 EDT 2005
                      ·  Tested with .NET WebService Studio and didn't work. by Wout de Zeeuw on Thu Mar 30 07:55:57 EST 2006
                        ·  Unbounded sequences working, use document style/literal encoding by Wout de Zeeuw on Thu Mar 30 10:03:59 EST 2006
  ·  WSDL Code Generation by Dag K?nig on Sat Dec 04 03:37:43 EST 2004
    ·  , by Christian Weyer on Sat Dec 04 05:06:31 EST 2004
    ·  WSDL Code Generation by Christian Weyer on Sat Dec 04 05:08:22 EST 2004
  Message #148101 Post reply Post reply Post reply Go to top Go to top Go to top

URL?

Posted by: Christian Weyer on December 02, 2004 in response to Message #148074
Do you have a URL to the WSDL - or can you post it?

  Message #148206 Post reply Post reply Post reply Go to top Go to top Go to top

WSDL URN

Posted by: Bruce Ingalls on December 03, 2004 in response to Message #148101
I'm not sure why you want the URL for my WSDLs.
They are inside a firewall, under test, and not publicly available (yet).
However, there are WSDLs available from tempuri.org, as well as the weather service. You can likely find more through UDDIs, such as uddi.microsoft.com.

The point is, I will be adding and changing my WSDLs, so I want to make such migrations smoother for users, via code generation. I am not the first to face the Microsoft nested sequences bug.

I am thinking of mitigating this, by seeing if Apache's wsdl2c will compile under Microsoft's .NET framework.
Maybe PocketSOAP, which already supports .NET is an easier solution.

  Message #148244 Post reply Post reply Post reply Go to top Go to top Go to top

Huh?

Posted by: Christian Weyer on December 03, 2004 in response to Message #148206
Strange - I thought you are seeking help, I offered you help.
If I do not have the WSDL, I cannot say you what is wrong (regardless who to blame...).
We wrote our own code generation tool for XSD and WSDL, so maybe we can solve your problem. But staying at an abstract level won't work.

PocketSoap is COM - yes you can use it via COM Interop in .NET... but that is a totally different story. Simon (Fell) is a great guy, bit we should try to solve the problems you face with the .NET tools, shouldn't we?

  Message #148275 Post reply Post reply Post reply Go to top Go to top Go to top

WSDL Code Generation

Posted by: Dag K?nig on December 04, 2004 in response to Message #148074
I understand your frustration. We use wsdl.exe heavily in our projects. The problem that we currently have is that we have found a bug in it. And we have right now an open case on it with Microsoft. (I think that our problem is of a different kind that yours.)

I'm also very interested if any other programs exist that could generate code from wsdl.

/dag
http://buzzfrog.blogs.com

  Message #148280 Post reply Post reply Post reply Go to top Go to top Go to top

,

Posted by: Christian Weyer on December 04, 2004 in response to Message #148275
Dag

  Message #148281 Post reply Post reply Post reply Go to top Go to top Go to top

WSDL Code Generation

Posted by: Christian Weyer on December 04, 2004 in response to Message #148275
Dag, can you elaborate on your problem? Thanks.

  Message #148474 Post reply Post reply Post reply Go to top Go to top Go to top

Example WSDL

Posted by: Bruce Ingalls on December 06, 2004 in response to Message #148244
OK, here is an exerpted essence of what is going on.
Again, Apache Axis's wsdl2j is happy, where wsdl.exe is not.
Our wsdl is not (yet) ready for public consumption, especially until we have the bugs worked out.

OK, now that you are a bit more explicit, I understand. You can see below, that we have a complex type that contains a sequence. This complex type itself is stored in a sequence.
In short, nested sequences.

Can you redistribute your wsdl tool?
We'd need to provide this to our customers, and regenerate code as we add or change WSDL interfaces.
____________________

  <wsdl:types>
    <schema targetNamespace="http://beans.pass.wsv.reg.com"
xmlns="http://www.w3.org/2001/XMLSchema">
      <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
      <complexType name="Account">
<sequence>
<element name="Name" nillable="true" type="xsd:string"/>
<element name="id" type="xsd:int"/>
</sequence>
      </complexType>
      <complexType name="AccountArray">
<sequence>
<element maxOccurs="unbounded" name="allAccounts" nillable="true"
type="tns1:Account"/>
<element name="wSError" nillable="true" type="xsd:string"/>
</sequence>
      </complexType>
    </schema>
  </wsdl:types>

  Message #148523 Post reply Post reply Post reply Go to top Go to top Go to top

WSCF 0.4

Posted by: Christian Weyer on December 07, 2004 in response to Message #148474
Bruce, if you like you can test our tool (it is free):
http://www.thinktecture.com/Resources/Software/WSContractFirst/default.html

Just be sure to read the licence agreement to get your questions asnwered.
If you like we can discuss your problems privately, so just go ahead and contact me via the web site above.

Thanks.

  Message #151754 Post reply Post reply Post reply Go to top Go to top Go to top

follow up

Posted by: Bruce Ingalls on January 06, 2005 in response to Message #148523
Thanks for introducing me to WSCF. It seems simpler than Microsoft's wsdl.exe et. al.
Unfortunately, WSCF seems to generate similar, if not simpler code than does Microsoft. This did not seem to help for my more complex WSDL problem.
I ended up recompiling Apache's Axis/C from scratch under the .NET framework. This worked smoothly, after some time wasting false starts.
I had problems calling the resulting generated .NET Managed C++ DLLs from C#, however. The code generation in .NET was smooth, so switching from C# to C++ is still possible.

After all that work, my customer ended up switching to Axis/Java :(

  Message #156347 Post reply Post reply Post reply Go to top Go to top Go to top

Did you resolve this?

Posted by: Murali Inguva on February 09, 2005 in response to Message #151754
Bruce Ingalls,
Did you resolve this issue. this stupid micro soft wsdl.exe is a pain in the neck. I love Microsoft except in this sinario. If you resolve this problem please let me know the answer ASAP (Please). Previously, I used to change the xsd's to solve the problem (which is the stupid solution provided by microsoft). Now i am at a stage that i cannot change the Xsd's. So please help me in this.
My address is minguva@hotmail.com (732 692 3331)
Thank You
Murali

  Message #156476 Post reply Post reply Post reply Go to top Go to top Go to top

Did you resolve this?

Posted by: Bruce Ingalls on February 10, 2005 in response to Message #156347
I gave up on using Microsoft wsdl.exe, and went with Java, instead.
Here are alternatives I can recommend:

1) Try Christian Weyer / Thinktecture's wsdl code generator. It likely won't work any better than Microsoft's wsdl.exe for you, but it is fast and easy, meaning that you won't waste much time trying it.

2) Try simplifying your WSDL. Get rid of arrays and complex structures, and replace them with poorly coded, flattened primitive objects (xsd:int, xsd:string, etc.)

3) Try Apache's wsdl2c (normally generates C++, not C). Forget about wsdl2java under .NET, as Sun does not provide source code to many required .jar files.
You must build your projects from scratch - don't waste time with the project files provided by Apache.
You've now changed this to a problem of migrating unmanaged code to managed, and figuring out how to invoke C++ from C# code.

4) Change your choice of language to Java or C++, and move away from .NET. Or, find a way to comminicate between the two, such as shared memory, system messages, etc.

5) .NET remoting is based atop SOAP, and I understand that Java's WSDP Web Services Development Pack is able to cross communicate, somehow, but I have not tried this personally, so I don't know how well this works.
I hope this helps; frankly, the picture is bleak.

  Message #156668 Post reply Post reply Post reply Go to top Go to top Go to top

Thank you for the reply

Posted by: Murali Inguva on February 12, 2005 in response to Message #156476
Hi Bruce,
Thank you very much for the help... Is there any way that i can get some more in this. I have to implement this. Is there any way that i can call you to discuss further more if you dont mind.
Thanks again

  Message #161015 Post reply Post reply Post reply Go to top Go to top Go to top

Not true

Posted by: Dino Chiesa on March 11, 2005 in response to Message #156668
However, there is a bug in Microsoft .NET's wsdl.exe code generator; it cannot generate proper C# code for multidimensional arrays, or arrays of complex types (structs).

This is not true.

There are examples of AXIS + .NET integration using complex types and arrays of same, and complex types that contain arrays of instances of the same complex types, and so on, and so forth.

Jagged arrays may require some special handling (introduction of the nestingLevel param on the arrayItem attribute) but they also work.

For one example, see http://dinoch.dyndns.org:7070/axis1.2/AboutCtService.jsp which illustrates interop between AXIS/Java 1.2RC3 and .NET v1.1, using arrays of complex types, which contain member arrays of complex types, and so on.

Nothing in this thread has explained just what the problem is. The only clear statement is "wsdl.exe cannot generate proper code". The working examples above show this to be not true.

-Dino
Microsoft

  Message #161114 Post reply Post reply Post reply Go to top Go to top Go to top

An update

Posted by: Dino Chiesa on March 11, 2005 in response to Message #161015
Couple of things.
First, the URL is not hyperlinked properly in the above message. I think the auto-hyperlink logic in TSS.NET doesn't like :7070. Try this link instead (redirected through tinyurl.com) :

http://dinoch.dyndns.org:7070/axis1.2/AboutCtService.jsp

Also, I updated that example to show "jagged arrays".

Jagged arrays are a special case, and if you want interop between AXIS and .NET, it requires a particular style of XSD type definition in the WSDL. For a 2D array, follow this pattern:
  <complexType name="MyComplexType">
   <sequence> ... </sequence>
  </complexType>

  <complexType name="ArrayCt">
   <sequence>
    <element maxOccurs="unbounded" name="item" nillable="true" type="tns1:MyComplexType" />
   </sequence>
  </complexType>

  <complexType name="Array2DCt">
   <sequence>
    <element maxOccurs="unbounded" name="item" nillable="true" type="tns1:ArrayCt" />
   </sequence>
  </complexType>

Of course you could substitute an xsd primitive type (int, float, string, whatever) for the named complextype in the above.

When the AXIS WSDL2Java tool consumes this schema definition, it
produces several "container types", named after the
xsd complexTypes. There is a java class named ArrayCt() which wraps
a single member, which is an array of MyComplexType. There is also a java class Array2DCt, which wraps a single member, an array of ArrayCt. They are beans, and use the bean serializer, not the AXIS array serializer.

When .NET parses the WSDL, it does not generate container types for these complexTypes that contain only an array. In .NET, therefore, the generated type is simply a jagged array.

As a result of this difference, there is a different programming
model on either end of the wire. In the AXIS/Java server, one
must do something like this :
  public proxyPackage.Array2DCt getJaggedArray(...) {
    ArrayCt[] a= new ArrayCt[n];
    for(int i=0; i < n; i++)
      a[i]= new ArrayCt( new MyComplexType[m] ) ;
    Array2DCt a2d= new Array2DCt(a);
    return a2d;
  }

...whereas in the .NET client, the programming model is a simple jagged
array:
  MyComplexType[][] jagged= stub.getJaggedArray();


All of this is with AXIS 1.2RC3 and .NET v1.1.

  Message #166046 Post reply Post reply Post reply Go to top Go to top Go to top

Can you help ?

Posted by: Zsolt h on April 13, 2005 in response to Message #161114
I need to use an Axis RPC style WSDL , the wsdl.exe can not process the file.
The wsdl can be reach at: http://stockinfo5.europe.webmatrixhosting.net/mInterface.xml
Can you help?
What I need to change in the wsdl file?

  Message #205005 Post reply Post reply Post reply Go to top Go to top Go to top

Tested with .NET WebService Studio and didn't work.

Posted by: Wout de Zeeuw on March 30, 2006 in response to Message #161015
Hi there,

I'm having similar problems with the wdsl.exe generated code. The generated data structures look ok, but they don't get filled in case of a unbounded sequence of complexType.

I just tested the http://dinoch.dyndns.org:7070/axis1.2/services/ComplexTypeService?wsdl site. Only method getComplexType worked, the others that returned array types gave problems though.

Anybody got a work around for the unbounded sequence/wdsl.exe problems?

Kind regards,

Wout

  Message #205024 Post reply Post reply Post reply Go to top Go to top Go to top

Unbounded sequences working, use document style/literal encoding

Posted by: Wout de Zeeuw on March 30, 2006 in response to Message #205005
Hi,

I got use unbounded sequences working in a .NET 2.0 client (web service returns an unbounded sequence). The web service has to use document style and literal encoding though. When using rpc style and encoded encoding the wdsl.exe generates different code and the result array ends up empty.

Wout

Recent active threads Recent active threads Recent active threads More More More
PPT to SWF (Flash) and PDF to SWF Conversion in .NET Application
Integrating 3rd Party Single Sign On into SharePoint Portal 2003
[ANN] Agile Cambridge 2010 - October 14-15
Solutions for open source data quality
Talend Appoints Vice President of Corporate Development
We had a fire at work today
How to add barcoding support to ASP.NET Mobile websites (VB.NET
More active threads »
Top posters of the weekTop posters of the weekTop posters of the week
This list contains the members who have made the most posts in all forums over the last 7 days:
  1. aspose seo
  2. Guru Talend
  3. Mark Dalgarno
  4. Jim Thorstad
  5. Sophie Everett
Hot threads Hot threads Hot threads More hot threads More hot threads More hot threads

Eclipse vs. Visual Studio at EclipseCon 2006

Speaking at EclipseCon 2006, Java developer and independent consultant Madhu Siddalingaiah compared Microsoft's Visual Studio IDE to the open source development environment of Eclipse.
(32 comments, last posted December 29, 2007)

Tech Talk: Peter Provost on CAB and Agile development

In this tech talk, Microsoft's Peter Provost talks about the design of the Composite UI Application Block and how the p&p team has led Microsoft in the adoption of Agile methodologies.
(0 comments, last posted April 17, 2006)

Book excerpt: Framework Design Guidelines

Chapter 4 of Framework Design Guidelines, titled "Type Design Guidelines," presents patterns that describe when and how to design classes, constructs and interfaces. In this chapter, Abrams and Cwalina divide types into four groups and discuss the do's and don'ts of type design.
(2 comments, last posted July 07, 2006)

Q&A: Miguel "Mono Man" De Icaza

Paul Ferrill caught up with prime open-source .NET applications driver Miguel De Icaza at Novell's BrainShare conference last week. They discussed the status of Windows Forms for Mono (it's coming along) and VB.NET for Mono (it looks like it's out).
(5 comments, last posted March 30, 2006)

Tech Talk: Jack Greenfield on software factories and DSLs

In this tech talk, Microsoft Visual Studio architect Jack Greenfield discusses the company's approach to Domain-Specific Languages, or DSLs, and the part they play in software factories.
(0 comments, last posted March 15, 2006)
More hot threads »

News | Blogs | Discussions | Tech talks | Patterns | Reviews | White Papers | Downloads | Articles | Media kit | About
All Content Copyright ©2007 TheServerSide Privacy Policy      Powered by JIVE
Site Map