Thursday, October 26, 2017

WebService TitBit-6

Components of EJB-JAR.xml


 < ejb-jar >
     < assembly-descriptor >
         < method-permission >
             < description > The employee and temp-employee roles may access any
                method of the EmployeeService bean  < / description >
             < role-name > employee < / role-name >
             < role-name > temp-employee < / role-name >
             < method >
                 < ejb-name > EmployeeService < / ejb-name >
                 < method-name > * < / method-name >
             < / method >
         < / method-permission >
         < method-permission >
             < description > The employee role may access the findByPrimaryKey,
                getEmployeeInfo, and the updateEmployeeInfo(String) method of
                the AardvarkPayroll bean  < / description >
             < role-name > employee < / role-name >
             < method >
                 < ejb-name > AardvarkPayroll < / ejb-name >
                 < method-name > findByPrimaryKey < / method-name >
             < / method >
             < method >
                 < ejb-name > AardvarkPayroll < / ejb-name >
                 < method-name > getEmployeeInfo < / method-name >
             < / method >
             < method >
                 < ejb-name > AardvarkPayroll < / ejb-name >
                 < method-name > updateEmployeeInfo < / method-name >
                 < method-params >
                     < method-param > java.lang.String < / method-param >
                 < / method-params >
             < / method >
         < / method-permission >
         < method-permission >
             < description > The admin role may access any method of the
                EmployeeServiceAdmin bean  < / description >
             < role-name > admin < / role-name >
             < method >
                 < ejb-name > EmployeeServiceAdmin < / ejb-name >
                 < method-name > * < / method-name >
             < / method >
         < / method-permission >
         < method-permission >
             < description > Any authenticated user may access any method of the
                EmployeeServiceHelp bean < / description >
             < unchecked/  >
             < method >
                 < ejb-name > EmployeeServiceHelp < / ejb-name >
                 < method-name > * < / method-name >
             < / method >
         < / method-permission >
         < exclude-list >
             < description > No fireTheCTO methods of the EmployeeFiring bean may be
                used in this deployment < / description >
             < method >
                 < ejb-name > EmployeeFiring < / ejb-name >
                 < method-name > fireTheCTO < / method-name >
             < / method >
         < / exclude-list >
     < / assembly-descriptor >
 < / ejb-jar > 

Saturday, October 21, 2017

WebService TitBit - 5

Best Explanation about wsgen / wsimport



Courtsy >>

https://coderanch.com/t/625764/certification/difference-wsimport-wsgen-command

1. Can we say that wsgen and wsimport command generates same classes (same JAX-WS artifacts)? 
2. Can we say that wsgen and wsimport command is used to generate both server and client side code ? 
3. can wsgen command be used to generate a WSDL file ? 

Correct me if I am wrong. 
wsgen and wsimport generates JAX-WS artifacts from SBI and WSDL respectively. 
If those JAX-WS artifacts do not exist, when the service is published using Endpoint.publish or web service container (Tomcat), those artifacts are dynamically generated. 
If those artifacts exist (generated by wsgen), the Endpoint.publish does not generate those artifacts. 

1. Yes. wsgen and wsimport generate request and response wrapper bean classes and the JAXB classes (XXX.class and XXXResponse.class). 

However, wsgen generates the JAXB classes and put them in a jaxws folder. But wsimport does not put those classes in any folder instead in the current directory. 
2. The JAX-WS artifacts generated can be used by both server and client side. 
3. I think wsgen can be used to generate WSDL. Here is an example at http://www.mkyong.com/webservices/jax-ws/jax-ws-wsgen-tool-example/

Thursday, October 19, 2017

WebService TitBits - 4

A service groups a set of related ports together:
< wsdl : definitions .... >
    < wsdl :  service name="nmtoken " > *
        < wsdl : port .... / > * 
    < / wsdl : service >
< / wsdl : definitions >
The name attribute provides a unique name among all services defined within in the enclosing WSDL document.
Ports within a service have the following relationship:
  • None of the ports communicate with each other (e.g. the output of one port is not the input of another).
  • If a service has several ports that share a port type, but employ different bindings or addresses, the ports are alternatives. Each port provides semantically equivalent behavior (within the transport and message format limitations imposed by each binding). This allows a consumer of a WSDL document to choose particular port(s) to communicate with based on some criteria (protocol, distance, etc.).
  • By examining it's ports, we can determine a service's port types. This allows a consumer of a WSDL document to determine if it wishes to communicate to a particular service based whether or not it supports several port types. This is useful if there is some implied relationship between the operations of the port types, and that the entire set of port types must be present in order to accomplish a particular task.

WebService TitBit - 3

Difference between Source.Mode.Message and Source.Mode.Payload .

Both are enum vars representing mode of  response .
Message

Operates directly with the entire message. For example, if a SOAP binding is used, then the entire SOAP envelope is accessed.

Payload

Operates on the payload of a message only. For example, if a SOAP binding is used, then the SOAP body is accessed.

For more details  >>

https://docs.oracle.com/cd/E17904_01/web.1111/e13734/provider.htm#WSADV559

which encoding style are acceptable by ws-basic profile  1.1 ?
 RPC-literal and Document literal 

for more details  >>

https://www.ibm.com/support/knowledgecenter/SSFTBX_8.5.7/com.ibm.wbpm.wid.integ.doc/access/topics/rwsdlstyle.html

# Types of XML signature  :

1) Eneveloping  Sign


.....

Signature will contain the object 

2) Eneveloped Sign 

.......
Signature will be eneveloped inside object 


3) Detached  

Signature will be  outside the document containing or referring data URL

Data to be signed is accessible through the Ref URI .

for more info check out >> https://www.ibm.com/support/knowledgecenter/en/SS3JSW_5.2.0/com.ibm.help.svcs_adpts_m_z.doc/XML_Dig_Sig_svc.html

Wednesday, October 11, 2017

WebService TitBit - 2

SAAJ.jar API that was available  externally before  ... has been integrated with JDK 1.6 . 
However higher releases are still available  outside .

Difference between Endpoint and EndpointReference 
Endpoint is the URL where your service can be accessed.
EndPointReference is a reference to itself.
check out here >> https://www.ibm.com/support/knowledgecenter/en/SSAW57_8.0.0/com.ibm.websphere.nd.doc/info/ae/ae/twbs_wsa_eprs_jaxws.html
EPR is mostly used  locally by a WebService.

Why WS-Addressing is needed ?

It is a transport neutral way to address WebService  For more info  check out  on web .

How to generate Faults  in SOAP ?
There are two types of SOAP faults  .
1) modeled - Exception are mapped to WSDL:fault tag
2) Unmodeled - Run time exceptions SOAPFaultException and RuntimeException messages are returned

Tuesday, October 3, 2017

WebService TitBit- 1

Difference between SOAP 1.1 and 1.2 

SOAP 1.1 technically allows XML elements
to occur after the SOAP body. In SOAP 1.2, by contrast, the SOAP body is the last XML
element in the SOAP envelope.

The 1.1 version binds SOAP
to HTTP transport, whereas the 1.2 version also supports SOAP over SMTP.

Thursday, September 14, 2017

Common terms in Web services

JAXB - API for XML Binding
JAXP - API for XML Processing
JAXM - API for XML Messaging
JAXR - API for XML Registries
JAX RPC - API for XML Remote Procedure Call
JAX TX - API for XML Transactions
JAAS- Java Authentication and Authorization Services 
JAF - Java Beans Activation Framework
JNDI- Java Native and Directory Interface
UDDI - Universal Description and Discovery Integration
WSDL - Web Service Description Language 
SOAP - Simple Object Access  Protocol
JSON - Java Script Object Notation
SAAJ- SOAP with Attachments for Java.


JAX WS ( API ) ( Metro = implementation ) ( requires WSDL ) 
JAX RS ( API ) ( Jersey = implementation ) 

Web service concept was developed to  remove short comings of  EJB .
An EJB can be also be deployed as  Web Service .

Since Java 1.6, there's a built-in HTTP server included with the JDK.
The HttpServer provides a simple high-level Http server API, which can be used to build embedded HTTP servers.
Endpoint.publish  accepts requests from a webservice  at a port at the same HTTP server .
for more into check out