-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doubt about namespaces, nil values, etc #8
Comments
Hi, Nano is just a light library targeting Android platform, considering the complexity introduced, it only supports a single target namespace. In your case, as workaround, I recommend you to do some hacking to the nano source, the code logic of nano is not complicated, hope you can make it:
Let me know if you need additional help. Thx! |
Hi William, could you elaborate on that a little more; I'm in the same situation trying to talk to a .net webservice, where nested namespaces seem to be used quite often. I've looked into the XmlPullWriter.java, and have several questions:
I'm trying to produce something along those lines: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tempuri="http://tempuri.org/"
xmlns:datacontract="http://schemas.datacontract.org/2004/07/SomeDataModel.Model">
<soapenv:Body>
<tempuri:GetPermissions>
<tempuri:login>
<datacontract:LoginName>user</datacontract:LoginName>
<datacontract:Password>pass</datacontract:Password>
</tempuri:login>
</tempuri:GetPermissions>
</soapenv:Body>
</soapenv:Envelope> Thank you for any hints! |
Hi, see my comments below:
Extract namespace from the object, if not empty, compare it with the namespace passed in, if not equal, use the extracted namespace instead. Thx! |
I have added this in XmlPullWriter.writeObject method: Is there any problem in this approach that would prevent this behavior to be added to the library ? About the empty objects, I started doing a patch to the writeElement method to handle it , but it didn't work very well when adding attributes to the xml. And in fact it was pointless as the namespaces were enough to make it work as intended and with a smaller xml output. |
Thx for your work and feedback, I plan to integrate the nested namespace logic into the latest source, will let you know when done. -William |
Thank you both! With your help, I finally managed to get my client to talk to a WCF web service. The only difference from my WCF reference implementation is that the native client declares all the namespace in the head: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tempuri="http://tempuri.org/"
xmlns:datacontract="http://schemas.datacontract.org/2004/07/SomeDataModel.Model">
<soapenv:Body>
<tempuri:GetPermissions>
<tempuri:login>
<datacontract:LoginName>user</datacontract:LoginName>
<datacontract:Password>pass</datacontract:Password>
</tempuri:login>
</tempuri:GetPermissions>
</soapenv:Body>
</soapenv:Envelope> whereas my solution using the modified XmlPullWriter (which isn't suited for this kind of refactoring, I presume) trivially writes the namespace on each element again: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://tempuri.org/">
<soapenv:Body>
<GetPermissions>
<login>
<n0:LoginName xmlns:n0="http://schemas.datacontract.org/2004/07/SomeDataModel.Model">user</n0:LoginName>
<n1:Password xmlns:n1="http://schemas.datacontract.org/2004/07/SomeDataModel.Model">pass</n1:Password>
</login>
</GetPermissions>
</soapenv:Body>
</soapenv:Envelope> It works, but is rather verbose, especially if several children use the same namespace, which has an even higher impact on a mobile uplink. I could mitigate this by using gzip (which is a good idea anyways), but that only works if I have control over the server's configuration. Is this a limitation of the current nano/XmlPullParser implementation we're dealing with here, or am I doing something wrong? Thanks for your support again! |
I ran into that issue as well, but I think in the current implementation it would be difficult to pre-declare the namespaces, unless one would traverse the hierarchy beforehand just to collect all the inner namespaces. |
How to get off this n0, n1, n2 when you put namespaces?
|
Hi, I'm trying to consume an API, the soap envelope generated by Nano looks like this:
It returns incorrect results from the WCF webservice.
The same input form is enveloped as this by a .NET MVC application:
What could be the reason it won't work ? Maybe the namespacing ? Nil value objects that aren't being encoded ?
The wsdl is: http://wsrobos.novaprolink.com.br/v2/WSConsultaProcessos.WSConsultaProcesso.svc?wsdl
Regards
nobre
The text was updated successfully, but these errors were encountered: