Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

11 views
Skip to first unread message

magister pips

unread,
Aug 24, 2007, 5:14:56 AM8/24/07
to
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

magister pips

unread,
Aug 24, 2007, 5:15:47 AM8/24/07
to

John Saunders [MVP]

unread,
Aug 24, 2007, 1:42:44 PM8/24/07
to
Please don't cross-post.

--
John Saunders [MVP]

Bob Barrows [MVP]

unread,
Aug 24, 2007, 3:20:58 PM8/24/07
to
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"


Randy Webb

unread,
Aug 24, 2007, 4:29:35 PM8/24/07
to
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/

John Saunders [MVP]

unread,
Aug 25, 2007, 8:42:56 PM8/25/07
to
"Randy Webb" <HikksNo...@aol.com> wrote in message
news:W4ydnVenzsA...@giganews.com...

> 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.


To Bob, I'd rather not read the same post "n" different times. YMMV.

To Randy, I just used "Reply Group" in Outlook Express. Thanks for pointing
out that this continues the cross-post. I had never noticed that before. I
always thought of it as "Reply" in e-mail vs. "Reply All" in e-mail.

--
John Saunders [MVP]

magister pips

unread,
Sep 20, 2007, 6:33:06 AM9/20/07
to
On 26 Aug, 01:42, "John Saunders [MVP]" <john.saunders at
trizetto.com> wrote:
> "Randy Webb" <HikksNotAtH...@aol.com> wrote in message

>
> news:W4ydnVenzsA...@giganews.com...
>
> > Bob Barrows [MVP] said the following on 8/24/2007 3:20 PM:
> >> John Saunders [MVP] wrote:
> >>> Please don't cross-post.
>
How am I suppose to garner the expertise from different newsgroups....

cross-post or multi-post

netiqette is becoming more complicated than gesha saki-sushi fest

John Saunders [MVP]

unread,
Sep 20, 2007, 1:30:49 PM9/20/07
to
"magister pips" <mba...@gmail.com> wrote in message
news:1190284386....@22g2000hsm.googlegroups.com...

> On 26 Aug, 01:42, "John Saunders [MVP]" <john.saunders at
> trizetto.com> wrote:
>> "Randy Webb" <HikksNotAtH...@aol.com> wrote in message
>>
>> news:W4ydnVenzsA...@giganews.com...
>>
>> > Bob Barrows [MVP] said the following on 8/24/2007 3:20 PM:
>> >> John Saunders [MVP] wrote:
>> >>> Please don't cross-post.
>>
> How am I suppose to garner the expertise from different newsgroups....

Post to the correct group. If you don't get an answer, post to the
next-most-correct group.

Most of the people likely to answer your question will be watching more than
one related group. As one of those people, I'd like to suggest that you
don't make me read your most more than once. If you do, you're likely to get
less than one answer from me.
--
--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer

0 new messages