tocleora
asked on
VB.Net and Soap for Noobs
I see a lot of topics on this site about Soap and VB.Net but for some reason they are all going over my head. I don't really understand all the specifics about it, I just need to call a wsdl file with some variables and get a response back. IN PHP it's this simple:
$client = new SoapClient ('path to wsdl');
$res = client->command(array('key ' => 'value'));
(where command is a command supported by the wsdl) and then I work with the results returned to res. I have this working in PHP great but I'd rather do it in VB. I don't know any of the xml calls being made to set headers and all of that stuff (most of the topics and articles I've read discuss setting xml manually, think this is where I'm getting lost), this is the extent of my knowledge of what to do. Can someone point me to a topic here or a resource somewhere else that breaks it down (or if you can explain it to me that's obviously acceptable as well) in an easy to understand way? Appreciate it!
$client = new SoapClient ('path to wsdl');
$res = client->command(array('key
(where command is a command supported by the wsdl) and then I work with the results returned to res. I have this working in PHP great but I'd rather do it in VB. I don't know any of the xml calls being made to set headers and all of that stuff (most of the topics and articles I've read discuss setting xml manually, think this is where I'm getting lost), this is the extent of my knowledge of what to do. Can someone point me to a topic here or a resource somewhere else that breaks it down (or if you can explain it to me that's obviously acceptable as well) in an easy to understand way? Appreciate it!
ASKER
No, unfortunately I'm self taught and not always familiar with the lingo. The information you gave me did work, but I'm not sure how to actually call it now. The wsdl is on localhost, and there's a reference for that, so I can now type in:
localhost.[command]
and see results for it, but they have eventArgs and eventHandler after them. I'm guessing these are classes but I don't have a lot of experience with classes (It's actually been a while since I've done any extensive vb programming, most in vb6). Could you give me an example of how to call that command and get the results from it? Then I think I'm good to go! Thanks a lot!
localhost.[command]
and see results for it, but they have eventArgs and eventHandler after them. I'm guessing these are classes but I don't have a lot of experience with classes (It's actually been a while since I've done any extensive vb programming, most in vb6). Could you give me an example of how to call that command and get the results from it? Then I think I'm good to go! Thanks a lot!
What did you call the Namespace (or did you leave it as the default)?
ASKER
Hmmm that could be part of what I did wrong. I've now done that part and I have a namespace called ServiceReference1. I can now pull up ServiceReference1.[command ]Request. But not sure what to do with it. does that answer your question or am I too confused at this point?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hmmm that didn't work for me. If I put:
ServiceReference1.AgentBri dgeClient c = new ServiceReference1.AgentBri dgeClient( );
It changes it to:
ServiceReference1.AgentBri dgeClient( c = new ServiceReference1.AgentBri dgeClient( ))
so I tried:
c = ServiceReference1.AgentBri dgeClient( )
and that didn't give me any errors.
Ok so here is the actual PHP code I'm using:
So when I do the next step:
string result = c.addListener('ID13');
well first, that doesn't work, it returns "string is a class type and cannot be used as an expression", so I changed it to:
Private Property result as string
result = c.addListener('ID13');
I get "Expression Expected" at the open parenthesis.
ServiceReference1.AgentBri
It changes it to:
ServiceReference1.AgentBri
so I tried:
c = ServiceReference1.AgentBri
and that didn't give me any errors.
Ok so here is the actual PHP code I'm using:
$client = new SoapClient('http://localhost:8080/AgentBridge?wsdl', array(
'cache_wsdl' => WSDL_CACHE_NONE,
'trace' => true));
$res = $client->addListener(array('name' => 'ID13'));
So when I do the next step:
string result = c.addListener('ID13');
well first, that doesn't work, it returns "string is a class type and cannot be used as an expression", so I changed it to:
Private Property result as string
result = c.addListener('ID13');
I get "Expression Expected" at the open parenthesis.
What functions do you see listed in Intellisense when you type "c." ?
ASKER
Ok I think I've figured it out, I think it was due to me using single quotes instead of double quotes. I think I have one last issue and I will have this fully function.
I have set result to a string, but it appears it wants to be of type "ServiceReference1.event". How do I convert that to a string? I tried result.toString but it didn't work. Almost there!
I have set result to a string, but it appears it wants to be of type "ServiceReference1.event".
ASKER
Think I have it figured out now. Thanks Kaufmed!
Once you do all this, interacting with the service becomes a matter of creating an instance of a class and calling its methos--something you should already know how to do = )