Send complex SOAP Objects

63 views
Skip to first unread message

rui.m.barreira

unread,
Feb 6, 2012, 8:06:59 AM2/6/12
to ksoap2-android
Hi,

I need to send this soap to a .NET WCF webservice:


<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/
envelope/" xmlns:tem="http://tempuri.org/" xmlns:qui="http://
schemas.datacontract.org/2004/07/QUiiQSharedLibrary">
<soapenv:Header/>
<soapenv:Body>
<tem:SetCommand>
<!--Optional:-->
<tem:sessionToken>86f04e4c</tem:sessionToken>
<!--Optional:-->
<tem:command>
<!--Optional:-->
<qui:CommandType>IDENTIFIER_MEMBER_VALUE</qui:CommandType>
<!--Optional:-->
<qui:Identifier>4</qui:Identifier>
<!--Optional:-->
<qui:MemberStates>
<!--Zero or more repetitions:-->
<qui:QUiiQMemberState>
<!--Optional:-->
<qui:Member>control</qui:Member>
<!--Optional:-->
<qui:Value>0</qui:Value>
</qui:QUiiQMemberState>
</qui:MemberStates>
</tem:command>
</tem:SetCommand>
</soapenv:Body>
</soapenv:Envelope>


I am using the following code:

Log.v("WSDL", "SOAP: SetCommand()");
String METHOD_NAME = "SetCommand";
String SOAP_ACTION = NAMESPACE + "IHomeControl_Service/" +
METHOD_NAME;

SoapSerializationEnvelope sse = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
sse.dotNet = true;

SoapObject obj = new SoapObject(NAMESPACE, METHOD_NAME);
obj.addProperty("sessionToken", session_token);


SoapObject command = new SoapObject(NAMESPACE, "command");
command.addProperty("CommandType", cmd.get_commandType().toString()
.toUpperCase());
command.addProperty("Identifier", cmd.get_identifier());

SoapObject member_states = new SoapObject(NAMESPACE,
"MemberStates");
List<QUiiQMemberState> member_state = cmd.get_memberStates();

for (int i = 0; i < member_state.size(); i++) {
SoapObject member = new SoapObject(NAMESPACE, "QUiiQMemberState");
member.addProperty("Member", member_state.get(i).get_member());
member.addProperty("Value", member_state.get(i).get_value());
member_states.addSoapObject(member);
}

command.addSoapObject(member_states);

obj.addSoapObject(command);


sse.setOutputSoapObject(obj);
// sse.bodyOut = obj;
HttpTransportSE ahttpTrans = new HttpTransportSE(URL);
ahttpTrans.call(SOAP_ACTION, sse);


But I keep getting wrong session ID ( I can guarantee that the session
ID is OK:) )

If I remove the command soap object, I get session token OK.

Can you please advice me on what am I doing wrong?

Thanks,

Rui

rui.m.barreira

unread,
Feb 13, 2012, 7:19:30 AM2/13/12
to ksoap2-android
NEW INFO!!


> I am using KSOAP 2 2.6.1 to call .NET webservices but I am facing a
> problem with one of the call that receives a custom .NET Object.
> This is the envelope SOAP UI sends and it is working:
> This is my code that is not working:
> Basically the Webservice is receiving the command as null. Any idea why?
>
>
> Thank you very much for your time.
>
>
> Best Regards,
>
Reply all
Reply to author
Forward
0 new messages