Parameters are null from Client.

L

Lee Franke

I've been bashing my head against the monitor for awhile on this one. I am
sure it is something simple that I have missed.

The client (VBS) calls a webservice. The webservice is called (I get the
error message) but all of the parameters are null. I added a check on the
first line to test for null and it always fails on that line.

I have check with SOAP trace and the data is really there.

Here is the code for the webservice. It always fails on the first line when
I post from a client that is Visual Basic Script.

[WebMethod(MessageName = "InsertComputerData",CacheDuration = 0,
Description = "InsertComputerData")]
public string InsertComputerData(string ComputerName, string Domain,
string Report_time, string SerialNumber_BIOS, string
SerialNumber_Entered, string Username,
string OS, string Version, string Service_Installed, string
Service_Running, string DP_UserNo,
string DP_MachineName, string DP_ServerName, string
DP_Last_Date_To_Server,
string Asset_Number, string Model_Number)
{
if(ComputerName == null) //<-----------FAILS RIGHT HERE
return "No data";
ComputerData oComp = new ComputerData();
oComp.ComputerName = ComputerName;
oComp.Domain = Domain;
oComp.Report_Time = Convert.ToDateTime(Report_time);
oComp.SerialNumber_BIOS = SerialNumber_BIOS;
oComp.SerialNumber_Entered = SerialNumber_Entered;
oComp.UserName = Username;
oComp.OS = OS;
oComp.Version = Version;
oComp.Service_Installed = Service_Installed;
oComp.Service_Running = Service_Running;
oComp.DP_UserNo = DP_UserNo;
oComp.DP_MachineName = DP_MachineName;
oComp.DP_ServerName = DP_ServerName;
oComp.DP_Last_Date_To_Server = DP_Last_Date_To_Server;
oComp.AssetNumber = Asset_Number;
oComp.ModelNumber = Model_Number;

return this.InsertToDB(oComp);
}

I used SOAP trace to grab the incoming SOAP message. I have also taken out
the "xsi:type="xsd:string" attribute for each parameter and it makes no
difference.
Here it is:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema"
xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:soap="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<InsertComputerData
xmlns:SOAPSDK4="ws.fnc.fujitsu.intranet.desktopinventory" SOAPSDK4:xmlns="">
<ComputerName xsi:type="xsd:string">lfrankedt1</ComputerName>
<Domain xsi:type="xsd:string">fnc.net.local</Domain>
<Report_time xsi:type="xsd:string">9/1/2006 12:14:13 PM</Report_time>
<SerialNumber_BIOS xsi:type="xsd:string">USV34004WR</SerialNumber_BIOS>
<SerialNumber_Entered
xsi:type="xsd:string">USV34004WR</SerialNumber_Entered>
<Username xsi:type="xsd:string">lfranke</Username>
<OS xsi:type="xsd:string">Microsoft Windows XP Professional</OS>
<Version xsi:type="xsd:string">5.2.2600</Version>
<Service_Installed xsi:type="xsd:string">Y</Service_Installed>
<Service_Running xsi:type="xsd:string">N</Service_Running>
<DP_UserNo xsi:type="xsd:string">99999999</DP_UserNo>
<DP_MachineName xsi:type="xsd:string">uswv34004wr</DP_MachineName>
<DP_ServerName xsi:type="xsd:string">rchdp01.fnc.net.local</DP_ServerName>
<DP_Last_Date_To_Server xsi:type="xsd:string">9/1/06 10:24:56
AM</DP_Last_Date_To_Server>
<Asset_Number xsi:type="xsd:string">42532</Asset_Number>
<Model_Number xsi:type="xsd:string">Dp 530d</Model_Number>
</InsertComputerData>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


And finally here is the VBS that calls the webservice. Currently it has the
values hardcoded (for testing).

Const URL = "http://lfrankedt1.fnc.net.local:8080/DesktopInvWS/Service.asmx"
Const ENC = "http://schemas.xmlsoap.org/soap/encoding/"
Const XSI = "http://www.w3.org/1999/XMLSchema-instance"
Const XSD = "http://www.w3.org/1999/XMLSchema"
Const NS = "ws.fnc.fujitsu.intranet.desktopinventory"
Const Method = "InsertComputerData"

Dim Today
Today = Now()

aParameters = Array("ComputerName",
"Domain","Report_time","SerialNumber_BIOS","SerialNumber_Entered","Username","OS","Version","Service_Installed","Service_Running","DP_UserNo","DP_MachineName","DP_ServerName","DP_Last_Date_To_Server","Asset_Number","Model_Number")
aValues =
Array("lfrankedt1","fnc.net.local",Today,"USV34004WR","USV34004WR","lfranke","Microsoft
Windows XP
Professional","5.2.2600","Y","N","99999999","uswv34004wr","rchdp01.fnc.net.local","9/1/06
10:24:56 AM","42532","Dp 530d")
Dim Connector
Set Connector = CreateObject( "MSSOAP.HttpConnector30" )
Dim Serializer
Set Serializer = CreateObject( "MSSOAP.SoapSerializer30" )

Dim Reader
Set Reader = CreateObject( "MSSOAP.SoapReader30" )
URI = NS
Connector.Property("EndPointURL") = URL
Call Connector.Connect
Connector.Property("SoapAction") = URI & "/" & Method
Call Connector.BeginMessage
Serializer.Init Connector.InputStream
Serializer.startEnvelope , ENC
Serializer.SoapNamespace "xsi", XSI
Serializer.SoapNamespace "soap", ENC
Serializer.SoapNamespace "xsd", XSD
Serializer.startBody
Serializer.startElement "InsertComputerData"
Serializer.SoapAttribute "xmlns", NS
Dim iCount
iCount =0
For Each sP in aParameters
WriteElement sP,aValues(iCount)
'MsgBox(sP & ":" & aValues(iCount))
iCount = iCount +1
Next
'WriteElement(PAR1,"lfrankedt1")
Serializer.endElement
Serializer.endBody
Serializer.endEnvelope
Connector.EndMessage
Reader.Load Connector.OutputStream
If Not Reader.Fault Is Nothing Then
MsgBox Reader.faultstring.Text, vbExclamation
Else
'Response is in Reader.DOM - just parse it
'Reader.RPCResult.XML
MsgBox(Reader.RPCResult.Text)
End If

Sub WriteElement(sName,sValue)
'MsgBox(sName & ":" & sValue)
Serializer.startElement sName
Serializer.SoapAttribute "type", , "xsd:string", "xsi"
Serializer.writeString sValue
Serializer.endElement
End Sub


thanks!!!

lee
 
J

John Saunders

Lee Franke said:
I've been bashing my head against the monitor for awhile on this one. I am
sure it is something simple that I have missed.

The client (VBS) calls a webservice. The webservice is called (I get the
error message) but all of the parameters are null. I added a check on the
first line to test for null and it always fails on that line.

I have check with SOAP trace and the data is really there.

"The data" may be there, but it's not the right data. You may have a
namespace mismatch.

<foo:elementName xmlns:foo="urn:bar"/> is one thing.

<elementName/> is another thing entirely. If your web service is looking for
foo:elementName, and gets elementName, then "null" is the correct parameter.

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top