Cyberactiva - webmaster tutorials, programming and videogames tricks

webmaster menu webmaster menu webmaster menu webmaster menu webmaster menu webmaster menu webmaster menu webmaster menu
  

parameter order when calling a web service

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! :)
> 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:


b









































transport="http://schemas.xmlsoap.org/soap/http"/>








hope this helps.


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/webservices/webservices/building/wse/

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

http://www.microsoft.com/downloads/details.aspx?familyid=9acd1f8e-97e2-43e2-b484-a74a014a8206&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" wrote in message
news:14F804A3-98E4-4423-B6F0-DE0627F674CB@microsoft.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:
>
> b
>
>
>
>

>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

>
>
> > message="tns:MainControllerInterface_checkUserAccessLoginResponse"/>
>

> > transport="http://schemas.xmlsoap.org/soap/http"/>
>
>
>
>
>
>

> hope this helps.
>
>> 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
-------------------
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" wrote in message
news:363752C6-14B5-456A-8BAB-760E113810C8@microsoft.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/webservices/webservices/building/wse/
> You can also learn WSE by walking through a Hands On Lab exercise:
> http://www.microsoft.com/downloads/details.aspx?familyid=9acd1f8e-97e2-43e2-b484-a74a014a8206&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" wrote in message
> news:14F804A3-98E4-4423-B6F0-DE0627F674CB@microsoft.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:
>>
>> b
>>
>>
>>
>>

>>

>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>

>>
>>
>> >> message="tns:MainControllerInterface_checkUserAccessLoginResponse"/>
>>

>> >> transport="http://schemas.xmlsoap.org/soap/http"/>
>>
>>
>>
>>
>>
>>

>> hope this helps.
>


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" wrote in message
> news:363752C6-14B5-456A-8BAB-760E113810C8@microsoft.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/webservices/webservices/building/wse/
> > You can also learn WSE by walking through a Hands On Lab exercise:
> > http://www.microsoft.com/downloads/details.aspx?familyid=9acd1f8e-97e2-43e2-b484-a74a014a8206&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" wrote in message
> > news:14F804A3-98E4-4423-B6F0-DE0627F674CB@microsoft.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:
> >>
> >> b
> >>
> >>
> >>
> >>

> >>

> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>

> >>
> >>
> >> > >> message="tns:MainControllerInterface_checkUserAccessLoginResponse"/>
> >>

> >> > >> transport="http://schemas.xmlsoap.org/soap/http"/>
> >>
> >>
> >>
> >>
> >>
> >>

> >> hope this helps.
> >
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/webservices/webservices/building/wse/
> You can also learn WSE by walking through a Hands On Lab exercise:
> http://www.microsoft.com/downloads/details.aspx?familyid=9acd1f8e-97e2-43e2-b484-a74a014a8206&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" wrote in message
> news:14F804A3-98E4-4423-B6F0-DE0627F674CB@microsoft.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:
> >
> > b
> >
> >
> >
> >

> >

> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >

> >
> >
> > > > message="tns:MainControllerInterface_checkUserAccessLoginResponse"/>
> >

> > > > transport="http://schemas.xmlsoap.org/soap/http"/>
> >
> >
> >
> >
> >
> >

> > hope this helps.
> >
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.
Register for freeMembers Area
Web MarketingLast Web Marketing
Web MarketingLast Programming Tips
Web MarketingLast News


Web Marketing Links and links exchange .