472,986 Members | 3,157 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

parameter order when calling a web service

Hi.

I'm having some problems consuming a webservice. The server keeps
complaining about the wrong element beeing sent..

I have this method that takes two strings String_1 and String_2
The server expects to get String_1 first, but somehow my client (C# .net cf)
sends String_2 first.. On top of that, If i build solution and run the .exe
file, it works fine.

Is there any way to control what order parameters are sent to the server?

Thanks in advance for any help! :)
May 29 '06 #1
8 2731
> I have this method that takes two strings String_1 and String_2
The server expects to get String_1 first, but somehow my client (C# .net
cf)
sends String_2 first.. On top of that, If i build solution and run the
.exe
file, it works fine.


Ensure that the proxy class generated is with the latest WSDL.

Can you shed some more light on what is the solution that you are talking
about and the exe is executed where?

--
Happy Hacking,
Gaurav Vaish
http://www.mastergaurav.org
http://webservices.edujini.in
-------------------
May 29 '06 #2
> Ensure that the proxy class generated is with the latest WSDL.

Can you shed some more light on what is the solution that you are talking
about and the exe is executed where?


Thanks for your reply.

The proxy class is from the latest WSDL.
The .exe is executed in a windows xp environment, forgot to mention that.

The solution is a document/literal web service that is supposed to log a
user in. The client supplies a username and a password.

The code for the client:

MainController service = new MainController();
service.Url = "http://10.0.102.112:8080/trim/ws";

try
{
checkUserAccessLogin login = new checkUserAccessLogin();
login.String_1 = brukernavn.Text;
login.String_2 = passord.Text;

checkUserAccessLoginResponse response =
service.checkUserAccessLogin(login);
Users user = response.result;

}
catch (Exception ex)
{
MessageBox.Show("ERROR: " + ex.Message);
}

relevant parts of the WSDL:

<complexType name="checkUserAccessLogin">
−
<sequence>
<element name="String_1" nillable="true" type="string"/>
<element name="String_2" nillable="true" type="string"/>
</sequence>
</complexType>

<element name="checkUserAccessLogin" type="tns:checkUserAccessLogin"/>

<complexType name="Users">
−
<sequence>
<element name="address" nillable="true" type="string"/>
<element name="cellPhone" nillable="true" type="string"/>
<element name="email" nillable="true" type="string"/>
<element name="firstName" nillable="true" type="string"/>
<element name="groupID" nillable="true" type="int"/>
<element name="homePhone" nillable="true" type="string"/>
<element name="isActive" type="int"/>
<element name="isAdmin" type="int"/>
<element name="isDeleted" type="int"/>
<element name="language" nillable="true" type="string"/>
<element name="lastIP" nillable="true" type="string"/>
<element name="lastLogin" nillable="true" type="string"/>
<element name="lastName" nillable="true" type="string"/>
<element name="position" nillable="true" type="string"/>
<element name="postNo" nillable="true" type="string"/>
<element name="postRegion" nillable="true" type="string"/>
<element name="userID" nillable="true" type="int"/>
<element name="userName" nillable="true" type="string"/>
<element name="userPass" nillable="true" type="string"/>
<element name="workPhone" nillable="true" type="string"/>
</sequence>
</complexType>

</types>
−
<message name="MainControllerInterface_checkUserAccessLogin ">
<part element="ns1:checkUserAccessLogin" name="parameters"/>
</message>

<operation name="checkUserAccessLogin">
<input message="tns:MainControllerInterface_checkUserAcce ssLogin"/>
<output message="tns:MainControllerInterface_checkUserAcce ssLoginResponse"/>
</operation>

<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
−
<operation name="checkUserAccessLogin">
<soap:operation soapAction=""/>
−
<input>
<soap:body use="literal"/>
</input>
−
<output>
<soap:body use="literal"/>
</output>
</operation>

hope this helps.

May 30 '06 #3
Unable to reproduce the error. In my tests using your WSDL, the parameters
were serialized/deserialized in the correct order. Have you been able to
capture the SOAP being sent from the client to verify that it is not being
serialized correctly?

As a side note, if you control the service, then strongly consider changing
the design to use a more secure approach. You should design this with
WS-Security, using WSE 3.0 or Windows Communication Foundation. Either of
these technologies will provide you with a better long-term strategy that is
much more secure and more flexible for security options down the road. It
is considered a bad security practice to pass the password back as the
result of a security call, as this can be used in an attack to try to
obtain other user's credentials.

You can find more information on the WSE home page:

http://msdn.microsoft.com/webservice.../building/wse/

You can also learn WSE by walking through a Hands On Lab exercise:

http://www.microsoft.com/downloads/d...displaylang=en
--
Kirk Allen Evans
Developer Evangelist
Microsoft Corporation
blogs.msdn.com/kaevans

=== This post provided "AS-IS" with no warranties and confers no rights ===
"Duffcase" <Du******@discussions.microsoft.com> wrote in message
news:14**********************************@microsof t.com...
Ensure that the proxy class generated is with the latest WSDL.

Can you shed some more light on what is the solution that you are talking
about and the exe is executed where?


Thanks for your reply.

The proxy class is from the latest WSDL.
The .exe is executed in a windows xp environment, forgot to mention that.

The solution is a document/literal web service that is supposed to log a
user in. The client supplies a username and a password.

The code for the client:

MainController service = new MainController();
service.Url = "http://10.0.102.112:8080/trim/ws";

try
{
checkUserAccessLogin login = new checkUserAccessLogin();
login.String_1 = brukernavn.Text;
login.String_2 = passord.Text;

checkUserAccessLoginResponse response =
service.checkUserAccessLogin(login);
Users user = response.result;

}
catch (Exception ex)
{
MessageBox.Show("ERROR: " + ex.Message);
}

relevant parts of the WSDL:

<complexType name="checkUserAccessLogin">
−
<sequence>
<element name="String_1" nillable="true" type="string"/>
<element name="String_2" nillable="true" type="string"/>
</sequence>
</complexType>

<element name="checkUserAccessLogin" type="tns:checkUserAccessLogin"/>

<complexType name="Users">
−
<sequence>
<element name="address" nillable="true" type="string"/>
<element name="cellPhone" nillable="true" type="string"/>
<element name="email" nillable="true" type="string"/>
<element name="firstName" nillable="true" type="string"/>
<element name="groupID" nillable="true" type="int"/>
<element name="homePhone" nillable="true" type="string"/>
<element name="isActive" type="int"/>
<element name="isAdmin" type="int"/>
<element name="isDeleted" type="int"/>
<element name="language" nillable="true" type="string"/>
<element name="lastIP" nillable="true" type="string"/>
<element name="lastLogin" nillable="true" type="string"/>
<element name="lastName" nillable="true" type="string"/>
<element name="position" nillable="true" type="string"/>
<element name="postNo" nillable="true" type="string"/>
<element name="postRegion" nillable="true" type="string"/>
<element name="userID" nillable="true" type="int"/>
<element name="userName" nillable="true" type="string"/>
<element name="userPass" nillable="true" type="string"/>
<element name="workPhone" nillable="true" type="string"/>
</sequence>
</complexType>

</types>
−
<message name="MainControllerInterface_checkUserAccessLogin ">
<part element="ns1:checkUserAccessLogin" name="parameters"/>
</message>

<operation name="checkUserAccessLogin">
<input message="tns:MainControllerInterface_checkUserAcce ssLogin"/>
<output
message="tns:MainControllerInterface_checkUserAcce ssLoginResponse"/>
</operation>

<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
−
<operation name="checkUserAccessLogin">
<soap:operation soapAction=""/>
−
<input>
<soap:body use="literal"/>
</input>
−
<output>
<soap:body use="literal"/>
</output>
</operation>

hope this helps.


May 30 '06 #4
>> Ensure that the proxy class generated is with the latest WSDL.
The proxy class is from the latest WSDL.
The .exe is executed in a windows xp environment, forgot to mention that.


Would reiterate... refresh you CF project (proxy class) for latest WSDL.
If it runs fine on desktop, it should behave identically from CF as well.
--
Happy Hacking,
Gaurav Vaish
http://www.mastergaurav.org
http://webservices.edujini.in
-------------------
May 30 '06 #5
Except that I just noticed you are running Compact Framework, and neither
WSE nor WCF run on NETCF yet.

I would still design this using WS-Security techniques with a UsernameToken,
hand-crufting the UsernameToken in the NETCF serialization code, and make
sure that you run the message over an SSL connection.

--
Kirk Allen Evans
Developer Evangelist
Microsoft Corporation
blogs.msdn.com/kaevans

=== This post provided "AS-IS" with no warranties and confers no rights ===
"Kirk Allen Evans" <ki***@online.microsoft.com> wrote in message
news:36**********************************@microsof t.com...
Unable to reproduce the error. In my tests using your WSDL, the
parameters were serialized/deserialized in the correct order. Have you
been able to capture the SOAP being sent from the client to verify that it
is not being serialized correctly?

As a side note, if you control the service, then strongly consider
changing the design to use a more secure approach. You should design this
with WS-Security, using WSE 3.0 or Windows Communication Foundation.
Either of these technologies will provide you with a better long-term
strategy that is much more secure and more flexible for security options
down the road. It is considered a bad security practice to pass the
password back as the result of a security call, as this can be used in an
attack to try to obtain other user's credentials.

You can find more information on the WSE home page:

http://msdn.microsoft.com/webservice.../building/wse/

You can also learn WSE by walking through a Hands On Lab exercise:

http://www.microsoft.com/downloads/d...displaylang=en
--
Kirk Allen Evans
Developer Evangelist
Microsoft Corporation
blogs.msdn.com/kaevans

=== This post provided "AS-IS" with no warranties and confers no rights
===
"Duffcase" <Du******@discussions.microsoft.com> wrote in message
news:14**********************************@microsof t.com...
Ensure that the proxy class generated is with the latest WSDL.

Can you shed some more light on what is the solution that you are
talking
about and the exe is executed where?


Thanks for your reply.

The proxy class is from the latest WSDL.
The .exe is executed in a windows xp environment, forgot to mention that.

The solution is a document/literal web service that is supposed to log a
user in. The client supplies a username and a password.

The code for the client:

MainController service = new MainController();
service.Url = "http://10.0.102.112:8080/trim/ws";

try
{
checkUserAccessLogin login = new checkUserAccessLogin();
login.String_1 = brukernavn.Text;
login.String_2 = passord.Text;

checkUserAccessLoginResponse response =
service.checkUserAccessLogin(login);
Users user = response.result;

}
catch (Exception ex)
{
MessageBox.Show("ERROR: " + ex.Message);
}

relevant parts of the WSDL:

<complexType name="checkUserAccessLogin">
−
<sequence>
<element name="String_1" nillable="true" type="string"/>
<element name="String_2" nillable="true" type="string"/>
</sequence>
</complexType>

<element name="checkUserAccessLogin" type="tns:checkUserAccessLogin"/>

<complexType name="Users">
−
<sequence>
<element name="address" nillable="true" type="string"/>
<element name="cellPhone" nillable="true" type="string"/>
<element name="email" nillable="true" type="string"/>
<element name="firstName" nillable="true" type="string"/>
<element name="groupID" nillable="true" type="int"/>
<element name="homePhone" nillable="true" type="string"/>
<element name="isActive" type="int"/>
<element name="isAdmin" type="int"/>
<element name="isDeleted" type="int"/>
<element name="language" nillable="true" type="string"/>
<element name="lastIP" nillable="true" type="string"/>
<element name="lastLogin" nillable="true" type="string"/>
<element name="lastName" nillable="true" type="string"/>
<element name="position" nillable="true" type="string"/>
<element name="postNo" nillable="true" type="string"/>
<element name="postRegion" nillable="true" type="string"/>
<element name="userID" nillable="true" type="int"/>
<element name="userName" nillable="true" type="string"/>
<element name="userPass" nillable="true" type="string"/>
<element name="workPhone" nillable="true" type="string"/>
</sequence>
</complexType>

</types>
−
<message name="MainControllerInterface_checkUserAccessLogin ">
<part element="ns1:checkUserAccessLogin" name="parameters"/>
</message>

<operation name="checkUserAccessLogin">
<input message="tns:MainControllerInterface_checkUserAcce ssLogin"/>
<output
message="tns:MainControllerInterface_checkUserAcce ssLoginResponse"/>
</operation>

<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
−
<operation name="checkUserAccessLogin">
<soap:operation soapAction=""/>
−
<input>
<soap:body use="literal"/>
</input>
−
<output>
<soap:body use="literal"/>
</output>
</operation>

hope this helps.


May 30 '06 #6
Thank you for your reply.

I intend to use some sort of security token to secure the service, however
I'm still in the initial process of developing a client to consume the
webservice. Thanks for the pointer though!
"Kirk Allen Evans" wrote:
Except that I just noticed you are running Compact Framework, and neither
WSE nor WCF run on NETCF yet.

I would still design this using WS-Security techniques with a UsernameToken,
hand-crufting the UsernameToken in the NETCF serialization code, and make
sure that you run the message over an SSL connection.

--
Kirk Allen Evans
Developer Evangelist
Microsoft Corporation
blogs.msdn.com/kaevans

=== This post provided "AS-IS" with no warranties and confers no rights ===
"Kirk Allen Evans" <ki***@online.microsoft.com> wrote in message
news:36**********************************@microsof t.com...
Unable to reproduce the error. In my tests using your WSDL, the
parameters were serialized/deserialized in the correct order. Have you
been able to capture the SOAP being sent from the client to verify that it
is not being serialized correctly?

As a side note, if you control the service, then strongly consider
changing the design to use a more secure approach. You should design this
with WS-Security, using WSE 3.0 or Windows Communication Foundation.
Either of these technologies will provide you with a better long-term
strategy that is much more secure and more flexible for security options
down the road. It is considered a bad security practice to pass the
password back as the result of a security call, as this can be used in an
attack to try to obtain other user's credentials.

You can find more information on the WSE home page:

http://msdn.microsoft.com/webservice.../building/wse/

You can also learn WSE by walking through a Hands On Lab exercise:

http://www.microsoft.com/downloads/d...displaylang=en
--
Kirk Allen Evans
Developer Evangelist
Microsoft Corporation
blogs.msdn.com/kaevans

=== This post provided "AS-IS" with no warranties and confers no rights
===
"Duffcase" <Du******@discussions.microsoft.com> wrote in message
news:14**********************************@microsof t.com...
Ensure that the proxy class generated is with the latest WSDL.

Can you shed some more light on what is the solution that you are
talking
about and the exe is executed where?
Thanks for your reply.

The proxy class is from the latest WSDL.
The .exe is executed in a windows xp environment, forgot to mention that.

The solution is a document/literal web service that is supposed to log a
user in. The client supplies a username and a password.

The code for the client:

MainController service = new MainController();
service.Url = "http://10.0.102.112:8080/trim/ws";

try
{
checkUserAccessLogin login = new checkUserAccessLogin();
login.String_1 = brukernavn.Text;
login.String_2 = passord.Text;

checkUserAccessLoginResponse response =
service.checkUserAccessLogin(login);
Users user = response.result;

}
catch (Exception ex)
{
MessageBox.Show("ERROR: " + ex.Message);
}

relevant parts of the WSDL:

<complexType name="checkUserAccessLogin">
−
<sequence>
<element name="String_1" nillable="true" type="string"/>
<element name="String_2" nillable="true" type="string"/>
</sequence>
</complexType>

<element name="checkUserAccessLogin" type="tns:checkUserAccessLogin"/>

<complexType name="Users">
−
<sequence>
<element name="address" nillable="true" type="string"/>
<element name="cellPhone" nillable="true" type="string"/>
<element name="email" nillable="true" type="string"/>
<element name="firstName" nillable="true" type="string"/>
<element name="groupID" nillable="true" type="int"/>
<element name="homePhone" nillable="true" type="string"/>
<element name="isActive" type="int"/>
<element name="isAdmin" type="int"/>
<element name="isDeleted" type="int"/>
<element name="language" nillable="true" type="string"/>
<element name="lastIP" nillable="true" type="string"/>
<element name="lastLogin" nillable="true" type="string"/>
<element name="lastName" nillable="true" type="string"/>
<element name="position" nillable="true" type="string"/>
<element name="postNo" nillable="true" type="string"/>
<element name="postRegion" nillable="true" type="string"/>
<element name="userID" nillable="true" type="int"/>
<element name="userName" nillable="true" type="string"/>
<element name="userPass" nillable="true" type="string"/>
<element name="workPhone" nillable="true" type="string"/>
</sequence>
</complexType>

</types>
−
<message name="MainControllerInterface_checkUserAccessLogin ">
<part element="ns1:checkUserAccessLogin" name="parameters"/>
</message>

<operation name="checkUserAccessLogin">
<input message="tns:MainControllerInterface_checkUserAcce ssLogin"/>
<output
message="tns:MainControllerInterface_checkUserAcce ssLoginResponse"/>
</operation>

<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
−
<operation name="checkUserAccessLogin">
<soap:operation soapAction=""/>
−
<input>
<soap:body use="literal"/>
</input>
−
<output>
<soap:body use="literal"/>
</output>
</operation>

hope this helps.

May 30 '06 #7
did you use .net cf when trying to reproduce the error?

"Kirk Allen Evans" wrote:
Unable to reproduce the error. In my tests using your WSDL, the parameters
were serialized/deserialized in the correct order. Have you been able to
capture the SOAP being sent from the client to verify that it is not being
serialized correctly?

As a side note, if you control the service, then strongly consider changing
the design to use a more secure approach. You should design this with
WS-Security, using WSE 3.0 or Windows Communication Foundation. Either of
these technologies will provide you with a better long-term strategy that is
much more secure and more flexible for security options down the road. It
is considered a bad security practice to pass the password back as the
result of a security call, as this can be used in an attack to try to
obtain other user's credentials.

You can find more information on the WSE home page:

http://msdn.microsoft.com/webservice.../building/wse/

You can also learn WSE by walking through a Hands On Lab exercise:

http://www.microsoft.com/downloads/d...displaylang=en
--
Kirk Allen Evans
Developer Evangelist
Microsoft Corporation
blogs.msdn.com/kaevans

=== This post provided "AS-IS" with no warranties and confers no rights ===
"Duffcase" <Du******@discussions.microsoft.com> wrote in message
news:14**********************************@microsof t.com...
Ensure that the proxy class generated is with the latest WSDL.

Can you shed some more light on what is the solution that you are talking
about and the exe is executed where?


Thanks for your reply.

The proxy class is from the latest WSDL.
The .exe is executed in a windows xp environment, forgot to mention that.

The solution is a document/literal web service that is supposed to log a
user in. The client supplies a username and a password.

The code for the client:

MainController service = new MainController();
service.Url = "http://10.0.102.112:8080/trim/ws";

try
{
checkUserAccessLogin login = new checkUserAccessLogin();
login.String_1 = brukernavn.Text;
login.String_2 = passord.Text;

checkUserAccessLoginResponse response =
service.checkUserAccessLogin(login);
Users user = response.result;

}
catch (Exception ex)
{
MessageBox.Show("ERROR: " + ex.Message);
}

relevant parts of the WSDL:

<complexType name="checkUserAccessLogin">
−
<sequence>
<element name="String_1" nillable="true" type="string"/>
<element name="String_2" nillable="true" type="string"/>
</sequence>
</complexType>

<element name="checkUserAccessLogin" type="tns:checkUserAccessLogin"/>

<complexType name="Users">
−
<sequence>
<element name="address" nillable="true" type="string"/>
<element name="cellPhone" nillable="true" type="string"/>
<element name="email" nillable="true" type="string"/>
<element name="firstName" nillable="true" type="string"/>
<element name="groupID" nillable="true" type="int"/>
<element name="homePhone" nillable="true" type="string"/>
<element name="isActive" type="int"/>
<element name="isAdmin" type="int"/>
<element name="isDeleted" type="int"/>
<element name="language" nillable="true" type="string"/>
<element name="lastIP" nillable="true" type="string"/>
<element name="lastLogin" nillable="true" type="string"/>
<element name="lastName" nillable="true" type="string"/>
<element name="position" nillable="true" type="string"/>
<element name="postNo" nillable="true" type="string"/>
<element name="postRegion" nillable="true" type="string"/>
<element name="userID" nillable="true" type="int"/>
<element name="userName" nillable="true" type="string"/>
<element name="userPass" nillable="true" type="string"/>
<element name="workPhone" nillable="true" type="string"/>
</sequence>
</complexType>

</types>
−
<message name="MainControllerInterface_checkUserAccessLogin ">
<part element="ns1:checkUserAccessLogin" name="parameters"/>
</message>

<operation name="checkUserAccessLogin">
<input message="tns:MainControllerInterface_checkUserAcce ssLogin"/>
<output
message="tns:MainControllerInterface_checkUserAcce ssLoginResponse"/>
</operation>

<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
−
<operation name="checkUserAccessLogin">
<soap:operation soapAction=""/>
−
<input>
<soap:body use="literal"/>
</input>
−
<output>
<soap:body use="literal"/>
</output>
</operation>

hope this helps.

May 30 '06 #8
As far as I understand there are two ways of passing parameters. Either
alphabetically or by position in the wsdl (which should be the "right" one).

But both should pass in my case. The String_1 comes first in both cases.
May 30 '06 #9

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

Similar topics

4
by: dave | last post by:
hi all, hope someone can help.... i'm having trouble calling an SP where the ORDER BY operator is specified as a parameter when the SP is called my SP is..... CREATE PROCEDURE...
2
by: dayblue | last post by:
My question has to do with the process of calling web services. Typically when the client calls a web service they can specify the timeout for the call. My question is how the actual web service...
3
by: Pratcp | last post by:
Hello, I have an asp.net Web app in vb.net trying to call a C# web service which takes a reference parameter. I tried a simple C# web app to call the Web service and it works perfectly. However,...
6
by: placek | last post by:
Hi all. I would like to create two web services: - The first one - ImportData - should take as an input parameter a XML document and return an integer saying if passed XML document was valid...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.