This piece of code I have written to make a request doesn't work. I have an example on Java but there are pieces of the code that I can't translate. Here is the sample code:
URL url = new URL (“http://www.costco.com”);
String encodingStyleURI = Constants.NS_URI_SOAP_ENC;
// Build the call.
Call call = new Call ();
call.setTargetObjectURI ("/ urn/ services");
call.setMethodName ("POST");
call.setEncodingStyleURI(encodingStyleURI);
// Make the call
Response resp = call.invoke (/* router URL */ url, /* actionURI */ "" );
// Check the response.
Parameter result = resp.getReturnValue();
System.out.println (result.getValue ()); }
How can I translate "String encodingStyleURI = Constants.NS_URI_SOAP_ENC;" and "call.setEncodingStyleURI(encodingStyleURI);" from java to C#??
I'm calling an Apache server with soap services I guess.
Late response but then again; I'm also a bit late to the party.
First; it would help much more if you'd tell us what it is you're trying to achieve. Trying to "translate" code one on one is bound to fail (IMO) because although your Java experience may get you quite far with C# there is a very important detail to realize:
C# is not a Java substitute. What I mean by that is that the number one mistake I've made in the past weeks was to approach C# with my Java experiences in mind.
It gets you far, but not all the way. Sometimes its best to simply look at what it is you're trying to achieve and rebuild it from scratch.
Coming from Java myself I looked into this but its hardly possible to answer. Because EE6 doesn't provide Call.SetTargetObjectURI out of the box it seems (javax.xml.rpc.Call). As such you could be using a toolbox of some sort that I don't know.
But using SOAP in ASP isn't all that hard, check out these URL's:
Then some stuff I picked up using Google. Even though some address classic ASP I think it might still help to get an idea as to how this all works, esp. when coming from a Java background (once again: your biggest enemy IMO is your Java experience):
oswaldotucu
0 Points
1 Post
From Java to C# Calling a web API
Jan 30, 2013 04:32 PM|LINK
Hi,
This piece of code I have written to make a request doesn't work. I have an example on Java but there are pieces of the code that I can't translate. Here is the sample code:
URL url = new URL (“http://www.costco.com”); String encodingStyleURI = Constants.NS_URI_SOAP_ENC; // Build the call. Call call = new Call (); call.setTargetObjectURI ("/ urn/ services"); call.setMethodName ("POST"); call.setEncodingStyleURI(encodingStyleURI); // Make the call Response resp = call.invoke (/* router URL */ url, /* actionURI */ "" ); // Check the response. Parameter result = resp.getReturnValue(); System.out.println (result.getValue ()); }How can I translate "String encodingStyleURI = Constants.NS_URI_SOAP_ENC;" and "call.setEncodingStyleURI(encodingStyleURI);" from java to C#??
I'm calling an Apache server with soap services I guess.
Any help please! Thank you
ShelLuser
Member
446 Points
82 Posts
Re: From Java to C# Calling a web API
Mar 24, 2013 09:55 AM|LINK
Late response but then again; I'm also a bit late to the party.
First; it would help much more if you'd tell us what it is you're trying to achieve. Trying to "translate" code one on one is bound to fail (IMO) because although your Java experience may get you quite far with C# there is a very important detail to realize: C# is not a Java substitute. What I mean by that is that the number one mistake I've made in the past weeks was to approach C# with my Java experiences in mind.
It gets you far, but not all the way. Sometimes its best to simply look at what it is you're trying to achieve and rebuild it from scratch.
Coming from Java myself I looked into this but its hardly possible to answer. Because EE6 doesn't provide Call.SetTargetObjectURI out of the box it seems (javax.xml.rpc.Call). As such you could be using a toolbox of some sort that I don't know.
But using SOAP in ASP isn't all that hard, check out these URL's:
The official documentation on using web services:
http://msdn.microsoft.com/en-us/library/t745kdsh.aspx
Then some stuff I picked up using Google. Even though some address classic ASP I think it might still help to get an idea as to how this all works, esp. when coming from a Java background (once again: your biggest enemy IMO is your Java experience):
http://jadendreamer.wordpress.com/2009/09/02/classic-asp-soap-request-code-example/
http://stackoverflow.com/questions/19318/calling-asp-net-web-service-from-asp-using-soapclient
Peter