[android-developers] WCF WebService and Android problem with Complex Types

2012-02-01 Thread chankly
Hi Guys !!

First... sorry by my english, i am spanish...

I have a android application which is connecting with a WCF
Service .NET using KSOAP2.

My client Android connect with the service OK. And my client can send
a complex data type and receive this.

The problem is in the server (Ok, i dont know if my problem is of .NET
or Android, but i am desesperate). The server recive my Complex Type,
but can't read the properties... it look arrive null.

However, the server re-send this object with properties changed, and
this new value YES arrive to my client android. :S

Why my server can not read the properties ??

The SOAP send to my WCF is this:
http://www.w3.org/2001/XMLSchema-instance";
xmlns:d="http://www.w3.org/2001/XMLSchema"; xmlns:c="http://
schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://
schemas.xmlsoap.org/soap/envelope/">http://tempuri.org/"; id="o0"
c:root="1">trueProbando


The Response in my client android is this:
http://schemas.xmlsoap.org/soap/
envelope/">http://www.w3.org/
2001/XMLSchema-instance">falsedata from server


Thanks all people for your time.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: WCF - Android - Complex Types - Can send, but properties arrived empty...

2012-01-16 Thread chankly
Thanks very much Codebear !!!

I did it and i can see this:




REQUEST

http://www.w3.org/2001/XMLSchema-instance";
xmlns:d="http://www.w3.org/2001/XMLSchema"; xmlns:c="http://
schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://
schemas.xmlsoap.org/soap/envelope/">http://tempuri.org/"; id="o0"
c:root="1">trueProbando






RESPONSE

http://schemas.xmlsoap.org/soap/
envelope/">http://www.w3.org/
2001/XMLSchema-instance">falsedata from server




In the response, in the text "data from server" must be more text...
The method in the server is this:


public CompositeType GetDataUsingDataContract(CompositeType
composite)
{

if (composite == null)
{
throw new ArgumentNullException("composite");
}


if (composite.BoolValue)
{
composite.StringValue += "Suffix";
}

composite.StringValue = "data from server";
return composite;
}


Sincerely... i dont know what happens.. :S

Thanks for your time.


On 16 ene, 17:01, codebear  wrote:
> While I cant speak to what is exactly wrong, try putting
> androidHttpTransport.debug = true. then after you make the
> androidHttpTransport.call() you can see responseDump and requestDump
> which contains the xml that is sent and recieved from the call. You
> can then compare it with the expected input... also I have heard there
> is a program that will help see what the request should look like.
> Maybe someone knows the name of the app im talking about?
>
> On Jan 13, 6:30 am, chankly  wrote:
>
>
>
>
>
>
>
> > Hi guys !!!
>
> > First... i'm sorry for my english... i am spanish, sorry.
>
> > I have a strange problem with my comunications.
>
> > I send a complex type from android to my service and i have anything
> > problem. All OK.
>
> > My service wcf recived the object, but... the properties is empty !!
>
> > however, my service update the properties and return to the client
> > which recived correctly the object with the values properties OK.
>
> > Please... can you help me??
>
> > My client code is this:
>
> > *
> > METHOD ACTIVITY WHICH CALL WEBSERVICE
> > *
> > private class LaunchWebService extends AsyncTask > Integer>
> >     {
>
> >                 @Override
> >                 protected Integer doInBackground(String... params)
> >                 {
>
> >                 try
> >                 {
>
> >                         SoapObject request = new SoapObject(NAMESPACE, 
> > METHOD_NAME);
>
> >                         //*** OBJECT ***
> >                         CompositeType objComposite = new CompositeType();
> >                         objComposite.setProperty(0, true); //This arrive 
> > false.
> >                         objComposite.setProperty(1, "this arrive null");
>
> >                         //*** ADD NEW PROPERTY TO ENVELOPE WITH THE OBJECT 
> > ***
> >                         PropertyInfo objParameter = new PropertyInfo();
> >                         
> > objParameter.setName("http://schemas.xmlsoap.org/soap/
> > envelope/");
> >                         objParameter.setName("composite");
> >                         objParameter.setValue(objComposite);
> >                         objParameter.setType(CompositeType.class);
>
> >                         request.addProperty(objParameter);
>
> >                         SoapSerializationEnvelope envelope = new
> > SoapSerializationEnvelope(SoapEnvelope.VER11);
> >                         envelope.dotNet = true;
> >                         envelope.setOutputSoapObject(request);
> >                         envelope.addMapping(NAMESPACE_CONTRACT, 
> > "CompositeType",
> > CompositeType.class);
>
> >                         HttpTransportSE and

[android-developers] WCF - Android - Complex Types - Can send, but properties arrived empty...

2012-01-16 Thread chankly
Hi guys !!!

First... i'm sorry for my english... i am spanish, sorry.

I have a strange problem with my comunications.

I send a complex type from android to my service and i have anything
problem. All OK.

My service wcf recived the object, but... the properties is empty !!

however, my service update the properties and return to the client
which recived correctly the object with the values properties OK.


Please... can you help me??


My client code is this:

*
METHOD ACTIVITY WHICH CALL WEBSERVICE
*
private class LaunchWebService extends AsyncTask
{

@Override
protected Integer doInBackground(String... params)
{


try
{

SoapObject request = new SoapObject(NAMESPACE, 
METHOD_NAME);

//*** OBJECT ***
CompositeType objComposite = new CompositeType();
objComposite.setProperty(0, true); //This arrive false.
objComposite.setProperty(1, "this arrive null");

//*** ADD NEW PROPERTY TO ENVELOPE WITH THE OBJECT ***
PropertyInfo objParameter = new PropertyInfo();
objParameter.setName("http://schemas.xmlsoap.org/soap/
envelope/");
objParameter.setName("composite");
objParameter.setValue(objComposite);
objParameter.setType(CompositeType.class);

request.addProperty(objParameter);


SoapSerializationEnvelope envelope = new
SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
envelope.addMapping(NAMESPACE_CONTRACT, "CompositeType",
CompositeType.class);


HttpTransportSE androidHttpTransport = new
HttpTransportSE(URL);
androidHttpTransport.call(SOAP_ACTION, envelope);

SoapObject response = 
(SoapObject)envelope.getResponse();
String txt = 
response.getProperty("StringValue").toString();

publishProgress(txt);

return 1;
}
catch(SoapFault exSoap)
{

exSoap.printStackTrace();

publishProgress(exSoap.getMessage());

return -1;
}
catch(Exception ex)
{

ex.printStackTrace();

publishProgress(ex.getMessage());

return -1;
}
}






*
COMPLEX TYPE DEFINITION
*
public class CompositeType implements KvmSerializable{

public static final int STRING_VALUE = 1;
public static final int BOOLEAN_VALUE = 0;

public String StringValue;
public Boolean BoolValue;

public CompositeType() {
}

@Override
public String toString() {
return "StringValue = " + StringValue + ", BoolValue = " +
BoolValue.toString();
}

@Override
public Object getProperty(int arg0) {
switch(arg0)
{
case STRING_VALUE:
return StringValue;
case BOOLEAN_VALUE:
return BoolValue;
}

return null;
}

@Override
public int getPropertyCount() {
return 2;
}

@Override
public void getPropertyInfo(int index, @SuppressWarnings("rawtypes")
Hashtable arg1, PropertyInfo info) {
switch(index)
{
case STRING_VALUE:
info.type = PropertyInfo.STRING_CLASS;
info.name = "StringValue";
break;
case BOOLEAN_VALUE:
info.type = PropertyInfo.BOOLEAN_CLASS;
info.name = "BoolValue";
break;
default:break;
}
}

@Override
public void setProperty(int index, Object value) {
switch(index)
{
case STRING_VALUE:
StringValue = value.toString();
break;
case BOOLEAN_VALUE:
BoolValue = Boolean.parseBoolean(value.toString());
break;
default:
break;
}
}


}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en