Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using complex type namespace
Message
From
31/08/2010 17:33:58
 
 
To
31/08/2010 17:19:08
General information
Forum:
ASP.NET
Category:
Web Services
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01479214
Message ID:
01479505
Views:
21
>>Say that you have a web service that looks like this in .NET (c# I'm afraid):
public class WebService1 : System.Web.Services.WebService
>>    {
>>          [WebMethod]
>>        public Something GetSomething()
>>        {
>>            return new Something();
>>        }
>>
>>        [WebMethod]
>>        public bool TakeSomething(Something s)
>>        {
>>            return true;
>>        }
>>    }
>>    public class Something
>>    {
>>        public string A { get; set; }
>>        public int B { get; set; }
>>        public SomethingElse C { get; set; }
>>    }
>>    public class SomethingElse
>>    {
>>        public string Name { get; set; }
>>    }
If you use WCF to reference this (the fact that it originates from .NET code is irrelevant) then you could use something like:
ServiceReference1.WebService1SoapClient sc = new ServiceReference1.WebService1SoapClient();
>>            ServiceReference1.Something s = new ServiceReference1.Something();
>>            ServiceReference1.SomethingElse se = new ServiceReference1.SomethingElse();
>>            se.Name = "Fred";
>>            s.C = se;
>>            sc.TakeSomething(new ServiceReference1.Something());
(Names could make more sense but it should demonstrate the basics....)
>
>I was able to establish all the references a few minutes ago. So, I assume if I call the method that it would work. Basically, there was a lot of levels of complexity in there. Basically, we have to establish references to new objects. Once those objects are initialized, we can define them. But, some of those objects, contain an additional level of structure. So, we have to define the sub structures and pass them to the main object. To add to that, the return result of the method returns in the same protocol. So, I have to define an object to receive all that.

If the webservice returns a specific object then the object should be already defined for you in the reference file.....

>
>Once it is defined, it can be easy to say "Well, it was not so bad!" But, there was pratically zero documentation on that one. So, it might not be easy for someone to find its way at first.
>
>But, thanks for the help. This has helped along the way.

I think a lot of the complexity arises because web service developers often design for their own consumption. In such cases the complexity is not relevant. They can just pass say a Customer object which has Orders which has Order Items which has Products etc, etc and it all pops out the other side as objects they are used to working with. If you need to consume the web service from another platform then the structures are not so obvious. If you have to design a web service for public consumption it's worth bearing in mind that the simpler the structures the better.....

Anyway good luck. EOD for me....
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform