High Level Design Document: - MarkMail

stizzahaddockΛογισμικό & κατασκευή λογ/κού

14 Δεκ 2013 (πριν από 3 χρόνια και 6 μήνες)

66 εμφανίσεις

IBM Requirement for extending JAXWS tooling to support
Non HTTP transports

High Level Design Document


Jayashree Viswanathan



12 June 2008


Summary


To be able to bind the Non
-
HTTP transport value with the SOAP, thereby adhering to the
upcoming standards
(
http://www.w3.org/Submission/SOAPJMS/
)

In other words,
Allow JAXWS tooling to tolerate non
-
http transport values defined in
wsdl, and in JAVA annotations.
Update c
ommand line tooling and runtime to
call out to
extensions/plugins to verify valid transport values have been provided. Making the
JAXWS tools more flexible for use by other runtimes
.



Technical Details



WSGEN

tool


Using
@BindingType annotation
:



@BindingType(SOAP/JMS value )


<soap:bi
nding transport=[soap/jms value]


(java ) (Generated WSDL)



Using
Command line option
:
(provided the plugin is available)



Wsgen

wsdl:soap/jms
<SEI>




<soap:binding transport=[soap/jms va
lue]


(command prompt) (Generated WSDL)



WSIMPORT

tool


The tool needs to tolerate the NON
-
HTTP transport value from WSDL file without
throwing warning. Currently the generated artifacts(java files)
seems to be fine. Ideally,
if plug
-
in is available, it could validate values provided and generate their own
appropriate

warning/error messages.


As per the requirement
the user would

perform the validation and give us the required
attribute values, proto
cols
, transport

etc., using the plugin support
,

without which JDK
will not be aware of these details.


Main Issues to address with current implementation


In the existing design, the code is highly coupled with the HTTP transport and SOAP 1
.
1
,
there is a
limited support for XSoap1.2, and no support for NON
-
HTTP transport.


Even if we create our own BindingId using
com.sun.xml.internal.ws.api
.

BindingIDFactory

, the transport value will still be overridden with HTTP value at the
time of Generation of WSDL.
Also With the current design the JDK will still be unaware
of the protocol/transport. Also considering making the tool more generic and extensible,
keeping upcoming new standards in mind, the validation of URL, generating URL and
obtaining the protocol/tra
nsport relevant information could be done through plugins
typical to that of BindingIDFactory class.


The command Line cannot take any transport value other than Soap1.1/HTTP and
Xsoap1.2/HTTP on which will error out.


WSIMPORT tool throws misleading warni
ngs if a NON
-
HTTP or NON
-
SOAP1.1
transport is used, saying non
-
http transport value is being ignored


There is no scope in the tool to add the SOAP:binding transport value though the other
elements/attributes can be added using the Extension.java mechanism



Please find below the code snippet. The code colored blue requires the modification.





VALIDATION

package com.sun.xml.internal.ws.api;

public abstr
act class BindingID {



public static final SOAPHTTPImpl SOAP11_HTTP = new SOAPHTTPImpl(


SOAPVersion.SOAP_11, SOAPBinding.SOAP11HTTP_BINDING, true);

…..

…..


public static @NotNull BindingID parse(String lexical) {


if(belongsTo(lexical
,SOAP11_HTTP.toString()))


return customize(lexical,SOAP11_HTTP);


if(…


if(belongsTo(lexical,SOAPBindingImpl.X_SOAP12HTTP_BINDING))


return customize(lexical,X_SOAP12_HTTP);



for(
BindingIDFactory f : ServiceFin
der.find(BindingIDFactory.class) ) {


BindingID r = f.parse(lexical);


if(r!=null)


return r;

}


throw new WebServiceException("Wrong binding ID: "+lexical);


package com.sun.tools.internal.ws.wscompile;

public c
lass WsgenOptions extends Options {



public void validate() throws BadCommandLineException {


if (!protocol.equalsIgnoreCase(SOAP11) &&


!protocol.equalsIgnoreCase(X_SOAP12)) {


throw new
BadCommandLineException
(Wscompi
leMessages.WSGEN_INVALID_PROTOCOL(proto
col, SOAP11 + ", " + X_SOAP12));


}

……..



if (transport != null && !transport.equalsIgnoreCase(HTTP)) {


throw new
BadCommandLineException(WscompileMessages.WSGEN_INVALID_TRANSPORT(tran
sport,
HTTP));


}

………





if (protocol == null || protocol.equalsIgnoreCase(X_SOAP12) && !isExtensionMode())

{


throw new
BadCommandLineException(WscompileMessages.WSGEN_SOAP_12_WITHOUT_EXTE
NSION());



Proposed Solution:


To write a new Abstract class that would be implemented by the user for doing the
follo
wing which would make the tool more
flexible:


Validat
e

the transport value and return a Boolean value true/false



Boolean validateURL(String SOAP_BINDING_TRANSPORT)



Generat
e
/get the Soap binding Transport Value for a g
iven protocol(SOAP1.1/SOAP1.2)
and transport(.This is for the Command line option when @BindingType annotation will
not be provided.


String GetURL(String protocol, String Transport)


To get the SOAP protocol type,transport value and MTOM values for a give
n Soap
binding Transport Value,as JDK will not be aware of the format of the URL as well.



String getProtocol(SOAP_BINDING_TRANSPORT);


String getTransport(SOAP_BINDING_TRANSPORT);


GENERATION

package com.sun.xml.internal.ws.ws
dl.writer;

public class WSDLGenerator {


protected void generateBinding() {

………



if (soapVersion == SOAPVersion.SOAP_12){


com.sun.xml.internal.ws.wsdl.writer.document.soap12.SOAPBinding
soapBinding = binding.soap12Bin
ding();


soapBinding.transport(SOAP12_HTTP_TRANSPORT);


if (sBinding.getStyle().equals(Style.DOCUMENT))


soapBinding.style(DOCUMENT);


else


soapBinding.
style(RPC);


} else {


com.sun.xml.internal.ws.wsdl.writer.document.soap.SOAPBinding soapBinding =
binding.soapBinding();


soapBinding.transport(SOAP_HTTP_TRANSPORT);


if (sBinding.getStyl
e().equals(Style.DOCUMENT))


soapBinding.style(DOCUMENT);


else


soapBinding.style(RPC);


String ge
tMTOM(SOAP_BINDING_TRANSPORT);


OR


String getProTraMTOM(SOAP_BINDING_TRANSPORT); where the
String returned would be for ex :SOAP11_JMS_MTOM



If Xsoap1.2 to Soap1.2 conversion in wsge
n is required then to get a Soap1.2 value from
Xsoap1.2 binding Transport Value


String generateURL(XSOAP_BINDING_TRANSPORT1); where the string
returned would give a SOAP_BINDING_TRANSPORT value

Validate a transport/protocol value passe
d in the command line option.


Boolean validateProTrans(String Protocol, String Transport);


This function is to validate the protocol and transport value passed in command
line
option,

so as to confirm if some junk values
would be errored out in command line
option as unsupported value.


On

Wsimport warnings/errors being thrown for non
-
HTTP has to be validated with the
new Soap binding transport value as well.


JDK has to do the required changes to validate and generate the

NON
-
HTTP(JMS) value
using the user’s plugin implementation of the abstract class for both WSIMPORT and
WSGEN tool.


The pseudo code in blue are the proposed modifications
.


VALIDATE:

package com.sun.xml.internal.ws.api;

public abstract class BindingID {


public static final SOAPHTTPImpl SOAP11_HTTP = new SOAPHTTPImpl(


SOAPVersion.SOAP_11, SOAPBinding.SOAP11HTTP_BINDING, true);

…..

…..


public static @NotNull BindingID parse(String lexical) {


if(belongsTo(lexical,SOAP11_HTTP.toString()
))


return customize(lexical,SOAP11_HTTP);


if(…


if(belongsTo(lexical,SOAPBindingImpl.X_SOAP12HTTP_BINDING))


return customize(lexical,X_SOAP12_HTTP);


}


for( BindingIDFactory f : ServiceFinder.find(BindingIDF
actory.class) ) {


BindingID r = f.parse(lexical);


if(r!=null)


return r; }

for(NewabstractClass a : ServiceFinder.find(NewabstractClass.Class) )

{Boolean validate = a.validate
URL
(lexical);


If(validate)

{


a.getSoapv
ersion();

a.getMtom();

Create a binding ID based on if it is soap1.1/xsoap1.2 and mtom

Return bindingID

}

Else

{set no Abstractclassfound webserviceException

}

}



//throw new WebServiceException("Wrong binding ID: "+lexical);

Throw new WebServic
eException(“Wrong Binding ID/Validation failure”+lexical);


package com.sun.tools.internal.ws.wscompile;

public class WsgenOptions extends Options {



public void validate() throws BadCommandLineException {


if (!protocol.equalsIgnoreCase(SOAP11)

&&


!protocol.equalsIgnoreCase(X_SOAP12)) {


throw new
BadCommandLineException(WscompileMessages.WSGEN_INVALID_PROTOCOL(protocol, SOAP11
+ ", " + X_SOAP12));


}

……..

find NewabstractClass

if (
!newAbsClassImplObj. validateT
ransport(protocol,transport)

{
notOther
Known
Transport = true;

set Exception

}



if (transport != null && !transport.equalsIgnoreCase(HTTP
)
||
notOther
Known
Transport
) {

{


throw new
BadCommandLineException(WscompileMessages.WSGEN_INVALID_TRAN
SPORT(transport, HTTP));


:todo exception needs to be modified






}

………



if (protocol == null || protocol.equalsIgnoreCase(X_SOAP12) && !isExtensionMode())
{


throw new
BadCommandLineException(Wscompile
Messages.WSGEN_SOAP_12_WITHOUT_EXTENSION());



GENERATION:


package com.sun.xml.internal.ws.wsdl.writer;

public class WSDLGenerator {


protected void generateBinding() {


extension.addBindingExtension(binding);

……………………………


if (soa
pVersion == SOAPVersion.SOAP_12){


com.sun.xml.internal.ws.wsdl.writer.document.soap12.SOAPBinding soapBinding =
binding.soap12Binding();


//

soapBinding.transport(SOAP12_HTTP_TRANSPORT);

todo: find NewabstractClass and

getTransport or

pass the transport value set initially in WsgenOptions


and
set this transport


soapBinding.transport(
Transport_passed);



if (sBinding.getStyle().equals(Style.DOCUMENT))


soapBinding
.style(DOCUMENT);


else


soapBinding.style(RPC);


} else {


com.sun.xml.internal.ws.wsdl.writer.document.soap.SOAPBinding soapBinding =
binding.soapBinding();



//

soa
pBinding.transport(SOAP_HTTP_TRANSPORT);

todo: find NewabstractClass and getTransport or

pass the transport value set initially in WsgenOptions


and
set this transport



soapBinding.transport(
Transport_passed);





if (sBin
ding.getStyle().equals(Style.DOCUMENT))


soapBinding.style(DOCUMENT);


else


soapBinding.style(RPC);