473,403 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

problem with null parameters passed from XMLHTTP in javascript to C# Webservice with SOAP

Hello, I have encountered some strange behaviour when using the
XMLHTTP Request object in Javascript to return xml from a C#
Webservice Method. I create a SOAP envelope and send it off to the
Webservice, which I have debug points in, which when hit I can see
that all the parameters are coming thru as null. I can't figure out
why this is, any experts out there would be a great help.

Here is my javascript:

function showMsga()
{
if(window.ActiveXObject) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e) {
try {
req = new ActiveXObject("Microsoft.XMLHTTP"); }
catch(e) {
req = false;
}
}
}
else if(window.XmlHttpRequest) {
try {
req = new XmlHttpRequest();
}
catch(e) {
req = false;
}
}

var wer = window.location;

if(req) {
var strEnvelope = "<?xml version=\"1.0\" encoding=\"utf-8\"?>
\n"+ "<soap:Envelope xmlns:xsi=\" http://www.w3.org/2001/XMLSchema-instance\""
+
" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"" + " xmlns:soap=
\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +
"<soap:Body>\n" +
"<MyMethod xmlns=\"https://freedom.org/MyService\">\n" +
"<tpid xsi:type=\"xsd:string\">3083</tpid>\n" +
"<poid xsi:type=\"xsd:string\">1045</poid>\n" +
"</MyMethod>" + "</soap:Body>" + "</soap:Envelope>";

req.onreadystatechange = GetMessage;
req.open("POST","http://"+window.location.hostname+"/MyService/
Service.asmx",true);
req.setrequestheader("Content-type", "text/xml");
req.setRequestHeader("SOAPAction","https://freedom.org/MyMethod");
req.send(strEnvelope);
}
}

here is the C# for the WebService method

[WebMethod]
public string MyMethod(string tpid, string poid)
{
int userID = Users2.GetUserID();

DataProvider dp = DataProvider.Instance();

if(Convert.ToInt32(poid)>0)
{
return dp.GetPostDetail(Convert.ToInt32(poid), userID);
}
else
{
return dp.GetTopicDetail(Convert.ToInt32(tpid), userID);
}
}

originally the method took integers but I switched them to strings in
the hope they would work,
any and all comments and hints are greatly appreciated.

Thanks,
Matt

Aug 24 '07 #1
3 2017
Please don't cross-post.

--
John Saunders [MVP]

Aug 24 '07 #2
John Saunders [MVP] wrote:
Please don't cross-post.
I'd rather he crosspost (as he did) than multipost. Perhaps you forgot to
type " ... to so many unrelated newsgroups."
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Aug 24 '07 #3
Bob Barrows [MVP] said the following on 8/24/2007 3:20 PM:
John Saunders [MVP] wrote:
>Please don't cross-post.

I'd rather he crosspost (as he did) than multipost. Perhaps you forgot to
type " ... to so many unrelated newsgroups."
What is truly ironic is that he did what he asked not be done.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Aug 24 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Arne Holderbeke | last post by:
I'm doing my final project in PHP with a Soap webservice In the client script (PHP) 3 files are read into a string these strings and the name of the 3 files need to be passed to the webservice (...
2
by: Kapil Shah | last post by:
Hello Everybody, I am trying to develop code to use the correct version of XMLHTTP and use it to send SOAP envelope to WebService . The code works fine for the first time but then after that I get...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
18
by: A.M | last post by:
Hi, Is there any way to call a WSS web service method by using browser and see the XML result in browser as well? I have been told that there is query string syntax for calling...
9
by: MSDNAndi | last post by:
Hi, I have a set of simple webservices calls that worked fine using .NET Framework 1.0. I am calling a Java/Apache based webservices, the calling side is not able to supply a proper WSDL. ...
0
by: Alexiel | last post by:
Hi, i have a problem, I have a Java Client and i call my webservice on ..NET. This run perfectly just except when i send parameters don't work fine. I send my code : This is my java...
1
by: ScriptProblem | last post by:
Hi Guys, I have a security concern with Mozilla and Netscape browsers(In IE it gives secuirity pop window) in Remote server(Client's server).When I am trying to call an Asp.NET web service from...
3
by: magister pips | last post by:
Hello, I have encountered some strange behaviour when using the XMLHTTP Request object in Javascript to return xml from a C# Webservice Method. I create a SOAP envelope and send it off to the...
1
by: magister pips | last post by:
Hello, I have encountered some strange behaviour when using the XMLHTTP Request object in Javascript to return xml from a C# Webservice Method. I create a SOAP envelope and send it off to the...
0
by: magister pips | last post by:
Hello, I have encountered some strange behaviour when using the XMLHTTP Request object in Javascript to return xml from a C# Webservice Method. I create a SOAP envelope and send it off to the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.