Closed programmer117 closed 11 years ago
I agree that jquery.soap is missing a feature to include extra namespaces to the soap:Envelope. I've included this in the milestone 2.0.0 feature list. It will probably be called something like `envNamespaces' and look like:
envNamespaces: {
xsi: 'http://www.w3.org/2001/XMLSchema-instance',
another: 'http://anotherNamespace.com/'
}
I am in doubt weither jquery.soap should support the automatic generating of more complex XML as in your case.
Your XML:
<a1:myMethod xmlns:a1="http://www.mySpecialNamespace.org/">
<number>0</number>
<color xsi:type="a1:pastel">lavender</color>
<horizon xsi:type="a1:blues">
<ocean>aquamarine</ocean>
<sky>turqoise</sky>
</horizon>
</a1:myMethod>
JSON:
{
myMethod: {
number: 0,
color: 'lavender', // how to include attributes here??
horizon: { // and here?
ocean: 'aquamarine',
sky: 'turqoise'
}
}
}
maybe something like
color: {
attributes: {
'xsi:type': 'a1:pastel'
},
nodeValue: 'lavender'
}
Too bad xsi:type
is not allowed due to the :
. Something to find a workaround for... So this is something to be discussed and think thru. So for the time being:
params
as XML (as a string or XML DOM Object)?Ah ok. So for now, since what I'm doing is a unique deviation from how jquery.soap is currently implemented, I should just specify my params
as an XML string for the SOAP request exacly as I want it. At least I have started a discussion on this! I agree that it would be best if attributes could be specified in the params json!
And it's good to know that you've already been considering adding extra namespaces to the soap:Envelope!
Thank you for your help doedje! I really like this jquery.soap.js plugin!
Thanks, programmer117
Summerbreak is over... Time to recap...
As I think about it now it seems a bit silly to include code to be able to use JSON to create a XML structure that is beyond the capabilities of standard JSON, considering the fact that such a markup does already exist in the form of XML which is also supported by the plugin. So the case is this: for simple parameters you can use JSON, XML string of XML Object, whatever suits you best. For the more complex things, you'll have to use XML (and at the same time gain the advantage of ruling out any parse errors....)
I just think this makes much more sense...
Hello all, I propose remove support convector json to xml. You can convert json to xml using third party library and send soap request. For Example: http://goessner.net/download/prj/jsonxml/ https://code.google.com/p/x2js/
I added the additional namespace request to the TODO list. I'll close this issue just to keep a clean issues list..Thanx
In the SOAP demo, the following SOAP request is generated:
And in the demo, the
params
is literally defined as<test>some text here...</test>
However, I want to do something a little more complicated. This is the SOAP request that I want to automatically generate:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
right at the top at thesoap:Envelope
level, but to implement it, it looks like I have to hard code that into thejquery.soap.js
file in the SOAPRequest.toString function and add it as an additonal soapEnv.attr("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");a1
and the namespaceURLxmlns:a1="http://mySpecialNamespace"
for myMethod.number
which I already can do through the current SOAPTool.json2soap function.xsi:type
attribute that uses my namespace qualifiera1
and another element to describe itpastel
. To do this it looks like I'd need to add a childObject.attr line in SOAPTool.json2soap().xsi:type
attribute to more complex elements like horizon, which has two sub elementsocean
andsky
and those two sub elements can not have the attribute. This subtlety looks particularly difficult to implement.soap:Envelope
.I think I could accomplish this if I made a lot of significant changes to the
jquery.soap.js
file, but it'd be much better if you could update the baseline of the code to include this functionality, or show me how I can already do this and call $.soap to accomplish this specific SOAP request, because I want to be able to easily update my code whenever the latest version of thejquery.soap.js
file comes out.Thank you so much in advance for your help!!
Thanks, programmer117