|
Are you doing this from code? I have no idea how you're consuming your web service
If you're calling your web service from another application, Visual Studio can create a servicereference for you which will give you a nice proxy class you can use to call the web service methods just like they're local...
Mark Salsbery
Microsoft MVP - Visual C++
modified on Thursday, May 26, 2011 4:40 AM
|
|
|
|
|
Oh sorry for that. This is how I consume the web service. Basically, I post an XML to the web method
XmlDocument _xml = new XmlDocument();
_xml.Load(filePath);
ServicePointManager.ServerCertificateValidationCallback = AcceptAllCertificatePolicy;
WebRequest _request = WebRequest.Create((WebServiceURL));
_request.Credentials = new NetworkCredential(UserName, Password);
_request.Method = "POST";
_request.ContentType = "text/xml";
XmlTextWriter xw = new XmlTextWriter(_request.GetRequestStream(), Encoding.UTF8);
_xml.WriteTo(xw);
xw.Close();
WebResponse response = _request.GetResponse();
response.Close();
|
|
|
|
|
Why not use Visual Studio to make a proxy class for you so you don't have to do that all yourself?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Sorry I haven't mentioned that the real web service is created in Java. What I provided was just a test webservice to verify my solution. I have no control on the Web Service since it is owned by the client. I am not sure if creating a proxy class is still applicable even if the Web Service is not creating in .Net. Will it work even in this case? Sprry, I know I could verify this on my own but right now, there are no Java test web services so I have created my own, in .Net. I really appreciate your help on this. Thank you in advance.
|
|
|
|
|
I don't know about Java....you could ask on the Java board though!
Without .NET I don't believe the proxy class would apply...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Basically, as Mark suggested, you need to navigate to your webservice through your browser. From there, you can see the format of the XML messages that you will send/receive. You will also see the headers that you need to assign to your _request object before firing it up. I can see in your code that you havent assigned the SOAPAction header in your request object. You also need to set that if you are going to use SOAP, like this.
_request.Headers["SOAPAction"] = "[Value of SOAPAction, you can see this by navigating on the web method of the web service, through browser]";
After setting this, I believe your'e good to go. Just make sure that you are using the right format of XML that was provided on the web service.
Ignorance of the ability brings disability.
|
|
|
|
|
Hello,
I am using SOAP method to get a list of tours from a web service in the internet. The pictures in the tourlist do not show up because of LOCALHOST definition in their source. How can I set LOCALHOST in web config to use web services root address.
Thank you!
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
You can't. There is no setting in the web.config file that will convert the address in the data you receive. Do you know any developers who can help you with this?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I was expecting a solution rather than a judgment.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
Once you get the data back, why not just do a string replace LOCALHOST -> real host name? The issue isn't on your side, the web service isn't implemented properly. A web service should *NEVER* be returning LOCALHOST in URLs. You just need to work around the web service bug with the string replace.
|
|
|
|
|
Thank you very much that is what I needed.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
I guess you did find a developer to help you.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
You are not a developer but he was because of his answer (it doesn't matter if he is a beginner or advanced one). His solution worked out and will also work when upload my web service on any server. A developer mean is not God of coding? Are you?
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
JUNEYT wrote: You are not a developer but he was because of his answer
Thanks I needed a good laugh at the end of the day
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I am glad that I made you happy somehow but please have a toothpaste and toothbrush. Take it easy.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
A toothbrush and toothpaste? Sorry I think something got lost in translation. Why not just give up while your behind.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
We were actually not translating something but your behavior...
I didn't ask you if he was a developer. I was looking for a solution and he provided me so.
So don't give up! keep coding your own behavior.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
JUNEYT wrote: I was looking for a solution and he provided me so.
Yes, you asked "How can I set LOCALHOST in web config..."
To which my replay was, "You can't. There is no setting in the web.config file..."
How is that not a solution? Must have gotten lost in the translation, or perhaps I didn't use enough toothpaste
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Mark, I'm surprised by this response. The last bit is unusually unkind of you; you're always very helpful, in my experience. Are you having a bad day? Yes, the question implied a solution approach that won't work, but we are not all professionals here, with years of experience to draw from, and sometimes we get lost on a wrong track because of it. Your answer was initially excellent, but it wouldn't have taken a lot of effort for an expert like you to suggest another approach. I hope you have a better day tomorrow, and thank you for the help you've given me, a perpetual tyro, over the years...
Will Rogers never met me.
|
|
|
|
|
Roger Wright wrote: a perpetual tyro
Is this a common expression? I wonder how many people know what "tyro" means outside of the military and (possibly) civil aviation.
|
|
|
|
|
Well, I'm not military and I know what a tyro is; and I didn't need to look it up either.
|
|
|
|
|
I had to look it up. Is that some British word? I'd never heard it used in the US before, but then again, I'm not in the military.
|
|
|
|
|
I had the benefit of studying Latin at school, which helps. And no - it was a dead language when I studied it, I'm not that old.
|
|
|
|
|
As far as I've heard, I'm the only one among my vast collection of friends and acquaintances who has used it in a sentence, but they all understood what I said.
I learned the word as a child, and don't recall where; I wasn't aware of any connection to the military.
Will Rogers never met me.
|
|
|
|
|
hi
i have attach a Nokia 7610 as GSM to my cell phone. i received a call on my computer using AT command ATA in hyper terminal. but now i want to implement it in c#. any idea how can i do this. i have done all about serial port connection checking in c#.
thanks
|
|
|
|