You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Thoughts on feasibility of using Jsonix for Soap Client Using WSDL #154
the compiler seems to generate all the bindings for the wsdl... if we want to send the HTTP Post request we will need a way to wrap the soap envelope and unwrap the soap envelope... do you have any how to do this with jsonix ? or point me in a good direction ?
The compiler at the moment only generates mappings for schema types and elements, not for SOAP operations.
Ulimately I think it is possible to generate a ready-to-use SOAP client with Jsonix based on WSDL. I'm not a SOAP pro so I might be wrong but here's the general outline.
From what I understand, WSDL defines operations which take some (schema-defined) XML as input and give some XML as output. This XML is payload wrapped in some SOAP envelopes and stuff. A Jsonix-based SOAP client would do the following:
Take some nice JS/JSON data as input.
Wrap it in a SOAP envelope.
Marshal it in XML.
Perform the POST request, get some XML back.
Unmarshal the XML.
Unwrap the payload from the response.
Give the result back.
From these points above, Jsonix provides marshalling/unmarshalling JS<->XML.
One thing which is missing is the wrapping/unwrapping SOAP envelopes. I'd do this before converting to/from XML, so in this case you'd generates mappings for SOAP schemas and just wrap your JS payload in SOAP envelope in JS. Then Jsonix will be able to marshal/unmarshal the complete SOAP envelope with your payload in XML.
This would require compiling SOAP schemas with Jsonix Schema Compiler. This is absolutely possible, I even thing it was done already, but I could not find it.
Next, developing the SOAP client. I actually think that such a client may be generated automatically from WSDL, but for starters it would be good to provide the basic framework for developing such clients. This framework would allow configuring WSDL operations in some easy manner (mappings?) and then overtaking wrapping/marshalling/requesting/unmarshalling/unwrapping cycle. So you'd just confiure which operations take which elements/types as input and the rest would be the library's task. I think this should not be too complex for basic cases, but there's quite a lot of crazy enterprize stuff in SOAP. I'd start small and grow it to demand.
Finally once you've got the library were you can configure operations in some declarative manner, the Jsonix Schema Compiler may be extended to generate SOAP client configs automatically. The current tech in use (JAXB XJC) focuses on generation from the XML Schema so probably some shift will be required. I think this must not be too complicated, at the end all this WS-generation in Java tools is based on XJC. Jsonix Schema Compiler will probably need to integrate wsimport, not just xjc but it must be possible.
How I'd start.
I'd start by building a pure XML test case. Take some open service which provides valid WSDL, create an XML request for this which can be tested via pure curl command. Get the XML back, check what it looks like.
Compile the WSDL with Jsonix Schema Compiler - you'll get mappings for the payload schema.
Compile required SOAP schemas with Jsonix Schema Compiler - you'll get mappings for the SOAP envelope wrappings.
Write tests for marshalling and unmarshalling of the sample SOAP XML requests and responses.
From that you'll be able to actually write develope the client for the said service. Try to make it configurable with mappings and some declarative config for operations.
I think this will give enough ground to develop SOAP clients with Jsonix. And I'll have the basis to think about client generation.
I will probably not be able to develop this myself. I personally have relatively small necessity for pure JS SOAP clients and I think this might be quite an effort to support in the long run.
Activity
highsource commentedon Oct 6, 2016
Should be possible but I did not experiment with it yet.
melorick commentedon Oct 6, 2016
the compiler seems to generate all the bindings for the wsdl... if we want to send the HTTP Post request we will need a way to wrap the soap envelope and unwrap the soap envelope... do you have any how to do this with jsonix ? or point me in a good direction ?
Regards,
highsource commentedon Oct 7, 2016
The compiler at the moment only generates mappings for schema types and elements, not for SOAP operations.
Ulimately I think it is possible to generate a ready-to-use SOAP client with Jsonix based on WSDL. I'm not a SOAP pro so I might be wrong but here's the general outline.
From what I understand, WSDL defines operations which take some (schema-defined) XML as input and give some XML as output. This XML is payload wrapped in some SOAP envelopes and stuff. A Jsonix-based SOAP client would do the following:
From these points above, Jsonix provides marshalling/unmarshalling JS<->XML.
One thing which is missing is the wrapping/unwrapping SOAP envelopes. I'd do this before converting to/from XML, so in this case you'd generates mappings for SOAP schemas and just wrap your JS payload in SOAP envelope in JS. Then Jsonix will be able to marshal/unmarshal the complete SOAP envelope with your payload in XML.
This would require compiling SOAP schemas with Jsonix Schema Compiler. This is absolutely possible, I even thing it was done already, but I could not find it.
Next, developing the SOAP client. I actually think that such a client may be generated automatically from WSDL, but for starters it would be good to provide the basic framework for developing such clients. This framework would allow configuring WSDL operations in some easy manner (mappings?) and then overtaking wrapping/marshalling/requesting/unmarshalling/unwrapping cycle. So you'd just confiure which operations take which elements/types as input and the rest would be the library's task. I think this should not be too complex for basic cases, but there's quite a lot of crazy enterprize stuff in SOAP. I'd start small and grow it to demand.
Finally once you've got the library were you can configure operations in some declarative manner, the Jsonix Schema Compiler may be extended to generate SOAP client configs automatically. The current tech in use (JAXB XJC) focuses on generation from the XML Schema so probably some shift will be required. I think this must not be too complicated, at the end all this WS-generation in Java tools is based on XJC. Jsonix Schema Compiler will probably need to integrate wsimport, not just xjc but it must be possible.
How I'd start.
curlcommand. Get the XML back, check what it looks like.I think this will give enough ground to develop SOAP clients with Jsonix. And I'll have the basis to think about client generation.
I will probably not be able to develop this myself. I personally have relatively small necessity for pure JS SOAP clients and I think this might be quite an effort to support in the long run.
melorick commentedon Oct 7, 2016
Thanks a lot for taking the time to answer my questions. I will try to do it that way, starting simple.
Regards,