invoke web service with complex type

Posted on 2005-04-20
Last Modified: 2010-04-16
I've generated classes for use in visual studio .net (c#), based on a given xsd schema that defines a genericMessage (with the xsd.exe-tool). Now I want to send a message to a web service that accepts this genericMessage-xml. In my main application I create an instance of the genericMessage class and try to send it: WebService.WebMethod(genericMessage-instance)

But the compiler complains that I have given the WebMethod invalid arguments.

And if I use the genericMessage class from the Web Reference to the Web Service and pass it to the web method, the program compiles, but when I test it, I get a missing dependencies error. (the Web Service I try to contact is written in java)

I don't understand why this doesn't work. When I invoke the web method it should create an xml and pass that to the web service right?

Can someone help?
Question by:DiederickH
    LVL 3

    Expert Comment

    Complex types aren't translated into XML equivalents if that's what you're asking.  Is the parameter you're trying to send composed on standard .net types (ie DataSets, XMLDocuments, etc.)?  If you've added the web reference to your project for the web service, you should have some type of ability to instantiate a compatible object.  .NET should be able to do this for you when you add the web reference.

    Any more info you can offer?  Or post a URL to the web services wsdl?
    LVL 3

    Expert Comment

    Let me rephrase, complex types aren't automatically translated into the object type that the webmethod is asking for...  


    Author Comment

    The problem has been solved. The problem was actually in the java web service. It was still using an older schema version of the genericMessage.

    Accepted Solution

    PAQed with points refunded (250)

    Community Support Moderator

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Suggested Solutions

    Article by: Ivo
    Anonymous Types in C# by Ivo Stoykov Anonymous Types are useful when  we do not need to follow usual work-flow -- creating object of some type, assign some read-only values and then doing something with them. Instead we can encapsulate this read…
    Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    759 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