Tag Archive: WSDL



It’s very common that you have to define a WSDL and want it to have custom header.

I have been using WSDL’s with custom headers for some time and thought I will post this sample WSDL for all of you who want to define a SOAP 1.1 WSDL with a custom message header.

Below is a Sample SOAP 1.1 WSDL with custom headers.

LocationFinderService.wsdl

<?xml version=”1.0″ encoding=”UTF-8″ standalone=”no”?>

<wsdl:definitions xmlns:soap=”http://schemas.xmlsoap.org/wsdl/soap/&#8221;

xmlns:tns=”http://www.nysolutionsltd.com/wsdl/utilityservices/addressfinderservice/LocationFinderServicev1.0/&#8221;

xmlns:wsdl=”http://schemas.xmlsoap.org/wsdl/&#8221;

xmlns:xsd=”http://www.w3.org/2001/XMLSchema&#8221;

name=”LocationFinderService”

xmlns:header=”http://www.nysolutionsltd.com/wsdlheaders/Headerv1.0&#8243;

targetNamespace=”http://www.nysolutionsltd.com/wsdl/utilityservices/addressfinderservice/LocationFinderServicev1.0/&#8221;

xmlns:xsd1=”http://www.nysolutionsltd.com/wsdlmessages/utilityservices/addressfinderservice/FindGeocodesForLocationv1.0″&gt;

<wsdl:types>

<xsd:schema

targetNamespace=”http://www.nysolutionsltd.com/wsdl/utilityservices/addressfinderservice/LocationFinderServicev1.0/”&gt;

</xsd:schema>

<xsd:schema xmlns:xsd=”http://www.w3.org/2001/XMLSchema”&gt;

<xsd:import

namespace=”http://www.nysolutionsltd.com/wsdlmessages/utilityservices/addressfinderservice/FindGeocodesForLocationv1.0&#8243;

schemaLocation=”../../../../../ServiceSchemas/internal/wsdlmessages/utilityservices/addressfinderservice/FindGeocodesForLocation.xsd”>

</xsd:import>

<xsd:import

schemaLocation=”../../../../../ServiceSchemas/internal/wsdlheaders/HeaderSchema.xsd”

namespace=”http://www.nysolutionsltd.com/wsdlheaders/Headerv1.0&#8243; />

</xsd:schema>

</wsdl:types>

<wsdl:message name=”MessageHeaderType”>

<wsdl:documentation>

The Messages used in the operations of this service are

defined here. The element attribute refers to the various

types defined in the schema.

</wsdl:documentation>

<wsdl:part name=”MessageHeaderType”

element=”header:MessageHeaderType” />

</wsdl:message>

<wsdl:message name=”findGeocodesForLocationRequest”>

<wsdl:part element=”xsd1:findGeocodesForLocationRequest”

name=”parameters” />

</wsdl:message>

<wsdl:message name=”findGeocodesForLocationResponse”>

<wsdl:part element=”xsd1:findGeocodesForLocationResponse”

name=”parameters” />

</wsdl:message>

<wsdl:portType name=”LocationFinderService”>

<wsdl:operation name=”findGeocodesForLocation”>

<wsdl:input message=”tns:findGeocodesForLocationRequest” />

<wsdl:output message=”tns:findGeocodesForLocationResponse” />

</wsdl:operation>

</wsdl:portType>

<wsdl:binding name=”LocationFinderServiceSOAP”

type=”tns:LocationFinderService”>

<soap:binding style=”document”

transport=”http://schemas.xmlsoap.org/soap/http&#8221; />

<wsdl:operation name=”findGeocodesForLocation”>

<soap:operation

soapAction=”http://www.nysolutionsltd.com/wsdl/utilityservices/addressfinderservice/LocationFinderServicev1.0/findGeocodesForLocation&#8221; />

<wsdl:input>

<soap:header message=”tns:MessageHeaderType”

part=”MessageHeaderType” use=”literal” />

<soap:body use=”literal” />

</wsdl:input>

<wsdl:output>

<soap:body use=”literal” />

</wsdl:output>

</wsdl:operation>

</wsdl:binding>

<wsdl:service name=”LocationFinderService”>

<wsdl:port binding=”tns:LocationFinderServiceSOAP”

name=”LocationFinderServiceSOAP”>

<soap:address location=”http://www.nysolutionsltd.com/&#8221; />

</wsdl:port>

</wsdl:service>

</wsdl:definitions>

For Custom headers

Things to note are to define the custom header type:

<xsd:schema xmlns:xsd=”http://www.w3.org/2001/XMLSchema”&gt;

<xsd:import

namespace=”http://www.nysolutionsltd.com/wsdlmessages/utilityservices/addressfinderservice/FindGeocodesForLocationv1.0&#8243;

schemaLocation=”../../../../../ServiceSchemas/internal/wsdlmessages/utilityservices/addressfinderservice/FindGeocodesForLocation.xsd”>

</xsd:import>

<xsd:import

schemaLocation=”../../../../../ServiceSchemas/internal/wsdlheaders/HeaderSchema.xsd”

namespace=”http://www.nysolutionsltd.com/wsdlheaders/Headerv1.0&#8243; />

</xsd:schema>

</wsdl:types>

<wsdl:message name=”MessageHeaderType”>

<wsdl:documentation>

The Messages used in the operations of this service are

defined here. The element attribute refers to the various

types defined in the schema.

</wsdl:documentation>

<wsdl:part name=”MessageHeaderType”

element=”header:MessageHeaderType” />

</wsdl:message>

And to include that in the input message:

<wsdl:input>

<soap:header message=”tns:MessageHeaderType”

part=”MessageHeaderType” use=”literal” />

<soap:body use=”literal” />

</wsdl:input>

For Soap 1.1 the namespace have to be

xmlns:soap=http://schemas.xmlsoap.org/wsdl/soap/

NOTE: this can be used with SOAP1.2 as well but you just need to update the WSDL bindings etc.

I will try and post a SOAP1.2 WSDL as well. But that’s for another day.

I use the O2 Broadband service its dirt cheap and service is so very good I would recommend the it to one and all.
http://nitinaggarwal.wordpress.com


The Code Generator tool consists of a command line version and an Ant Task.  I have attached a guidance to use the WSDL2Java utility using the command line.

Also, illustrated how to build file using custom Ant task and invoking the Code Generator from Ant.

Invoking the Code Generator From Ant

Since the users may find altering their ant class path a bit daunting they can also follow an easier technique. The code generator main class can be invoked directly through the build file.

Below is an example of a full build.xml needed to run WSDL2Java and generate the Java source files, compile the sources, and build an AAR file ready for deployment:

<?xml version=”1.0″ encoding=”UTF-8″?>

<project basedir=”.” default=”jar.server”>

<!–Auto generated ant build file–>

<property environment=”env”/>

<property name=”axis2.home” value=”${env.AXIS2_HOME}”/>

<property name=”project.base.dir” value=”.”/>

<property name=”maven.class.path” value=”"/>

<property name=”name” value=”ExaminerManagementService”/>

<property name=”src” value=”${project.base.dir}/src”/>

<property name=”test” value=”${project.base.dir}/test”/>

<property name=”build” value=”${project.base.dir}/build”/>

<property name=”classes” value=”${build}/classes”/>

<property name=”lib” value=”${build}/lib”/>

<property name=”resources” value=”${project.base.dir}/resources”/>

<property value=”XBeans-packaged.jar” name=”xbeans.packaged.jar.name”/>

<property value=”" name=”jars.ok”/>

<path id=”axis2.class.path”>

<pathelement path=”${java.class.path}”/>

<pathelement path=”${maven.class.path}”/>

<fileset dir=”${axis2.home}”>

<include name=”lib/*.jar”/>

</fileset>

</path>

<target name=”init”>

<mkdir dir=”${build}”/>

<mkdir dir=”${classes}”/>

<mkdir dir=”${lib}”/>

</target>

<target name=”jar.xbeans”>

<jar basedir=”${resources}” destfile=”${lib}/${xbeans.packaged.jar.name}” excludes=”**/services.xml, **/*.xsd”/>

</target>

<target depends=”init, jar.xbeans” name=”pre.compile.test”>

<!–Test the classpath for the availability of necesary classes–>

<available classpathref=”axis2.class.path” property=”xbeans.available” classname=”org.apache.xmlbeans.XmlObject”/>

<available classpathref=”axis2.class.path” property=”stax.available” classname=”javax.xml.stream.XMLStreamReader”/>

<available classpathref=”axis2.class.path” property=”axis2.available” classname=”org.apache.axis2.engine.AxisEngine”/>

<condition property=”jars.ok”>

<and>

<isset property=”xbeans.available”/>

<isset property=”stax.available”/>

<isset property=”axis2.available”/>

</and>

</condition>

<!–Print out the availabilities–>

<echo message=”XmlBeans Availability = ${xbeans.available}”/>

<echo message=”Stax Availability= ${stax.available}”/>

<echo message=”Axis2 Availability= ${axis2.available}”/>

</target>

<target depends=”pre.compile.test” name=”compile.src” if=”jars.ok”>

<javac debug=”on” memoryMaximumSize=”256m” memoryInitialSize=”256m” fork=”true” destdir=”${classes}” srcdir=”${src}”>

<classpath location=”${lib}/${xbeans.packaged.jar.name}”/>

<classpath refid=”axis2.class.path”/>

</javac>

</target>

<target depends=”compile.src” name=”compile.test” if=”jars.ok”>

<javac debug=”on” memoryMaximumSize=”256m” memoryInitialSize=”256m” fork=”true” destdir=”${classes}”>

<src path=”${test}”/>

<classpath location=”${lib}/${xbeans.packaged.jar.name}”/>

<classpath refid=”axis2.class.path”/>

</javac>

</target>

<target depends=”pre.compile.test” name=”echo.classpath.problem” unless=”jars.ok”>

<echo message=”The class path is not set right!                                Please make sure the following classes are in the classpath                                1. XmlBeans                                2. Stax                                3. Axis2                 “/>

</target>

<target depends=”jar.server, jar.client” name=”jar.all”/>

<target depends=”compile.src,echo.classpath.problem” name=”jar.server” if=”jars.ok”>

<copy toDir=”${classes}/META-INF” failonerror=”false”>

<fileset dir=”${resources}”>

<include name=”*.xml”/>

<include name=”*.wsdl”/>

<include name=”*.xsd”/>

<exclude name=”**/schemaorg_apache_xmlbean/**”/>

</fileset>

</copy>

<copy file=”${lib}/${xbeans.packaged.jar.name}” toDir=”${classes}/lib”/>

<jar destfile=”${lib}/${name}.aar”>

<fileset excludes=”**/Test.class” dir=”${classes}”/>

</jar>

</target>

<target if=”jars.ok” name=”jar.client” depends=”compile.src”>

<jar destfile=”${lib}/${name}-test-client.jar”>

<fileset dir=”${classes}”>

<exclude name=”**/META-INF/*.*”/>

<exclude name=”**/lib/*.*”/>

<exclude name=”**/*MessageReceiver.class”/>

<exclude name=”**/*Skeleton.class”/>

</fileset>

<fileset dir=”${resources}”>

<exclude name=”**/*.wsdl”/>

<exclude name=”**/*.xsd”/>

<exclude name=”**/*.xml”/>

</fileset>

</jar>

</target>

<target if=”jars.ok” depends=”jar.server” name=”make.repo”>

<mkdir dir=”${build}/repo/”/>

<mkdir dir=”${build}/repo/services”/>

<copy file=”${build}/lib/${name}.aar” toDir=”${build}/repo/services/”/>

</target>

<target if=”jars.ok” depends=”make.repo” name=”start.server”>

<java fork=”true” classname=”org.apache.axis2.transport.http.SimpleHTTPServer”>

<arg value=”${build}/repo”/>

<classpath refid=”axis2.class.path”/>

</java>

</target>

<target if=”jars.ok” depends=”jar.client” name=”run.test”>

<path id=”test.class.path”>

<pathelement location=”${lib}/${name}-test-client.jar”/>

<path refid=”axis2.class.path”/>

</path>

<mkdir dir=”${build}/test-reports/”/>

<junit haltonfailure=”yes” printsummary=”yes”>

<classpath refid=”test.class.path”/>

<formatter type=”plain”/>

<batchtest fork=”yes” toDir=”${build}/test-reports/”>

<fileset dir=”${test}”>

<include name=”**/*Test*.java”/>

</fileset>

</batchtest>

</junit>

</target>

<target name=”clean”>

<delete dir=”${build}”/>

</target>

</project>

The above build.xml depends on a build.properties file which defines ‘axis.home’, such as:

axis.home=/home/username/axis2-1.0-bin/

The above build.xml example also assumes three empty directories exist, ‘dist’, ‘lib’, and ‘src’.

Below is a validated WSDL Document following the Document/Literal Style. The name of this file matches the name used in the WSDL2Java ant task above, ExaminerManagementService.wsdl

<?xml version=“1.0″ encoding=“UTF-8″ standalone=“no”?>

<wsdl:definitions xmlns:soap=http://schemas.xmlsoap.org/wsdl/soap12/&#8221;

xmlns:tns=http://www.nysolutionsltd.com/ExaminerManagementService/&#8221;

xmlns:soapbind=http://schemas.xmlsoap.org/wsdl/soap12/&#8221; xmlns:wsdl=http://schemas.xmlsoap.org/wsdl/&#8221;

xmlns:xsd=http://www.w3.org/2001/XMLSchema&#8221; name=“ExaminerManagementService”

targetNamespace=http://www.nysolutionsltd.com/ExaminerManagementService/&#8221;>

<wsdl:types>

<xsd:schema targetNamespace=http://www.nysolutionsltd.com/ExaminerManagementService/&#8221;>

<xsd:element name=“GetPaymentDetailsRequest”>

<xsd:complexType>

<xsd:sequence>

<xsd:element name=“PaymentID” type=“xsd:string” />

</xsd:sequence>

</xsd:complexType>

</xsd:element>

<xsd:element name=“GetPaymentDetailsResponse”>

<xsd:complexType>

<xsd:sequence>

<xsd:element name=“out” type=“xsd:string” />

</xsd:sequence>

</xsd:complexType>

</xsd:element>

<xsd:element name=“GetExaminerPaymentsRequest”>

<xsd:complexType>

<xsd:sequence>

<xsd:element name=“ExaminerAccountCode” type=“xsd:string”

maxOccurs=“1″ minOccurs=“1″>

</xsd:element>

<xsd:element name=“AllocationMode” type=“xsd:string”

maxOccurs=“1″ minOccurs=“0″>

</xsd:element>

<xsd:element name=“JournalSource” type=“xsd:string”

maxOccurs=“1″ minOccurs=“0″>

</xsd:element>

<xsd:element name=“AccountingPeriodStartDate” type=“xsd:dateTime”

maxOccurs=“1″ minOccurs=“0″>

</xsd:element>

<xsd:element name=“TransactionDate” type=“xsd:dateTime”

maxOccurs=“1″ minOccurs=“0″>

</xsd:element>

<xsd:element name=“AccountingPeriodEndDate” type=“xsd:dateTime”

maxOccurs=“1″ minOccurs=“0″>

</xsd:element>

</xsd:sequence>

</xsd:complexType>

</xsd:element>

<xsd:element name=“GetExaminerPaymentsResponse”>

<xsd:complexType>

<xsd:sequence>

<xsd:element name=“ExaminerAccountCode” type=“xsd:string”

maxOccurs=“1″ minOccurs=“1″>

</xsd:element>

<xsd:element name=“AllocationMode” type=“xsd:string”

maxOccurs=“1″ minOccurs=“0″>

</xsd:element>

<xsd:element name=“JournalSource” type=“xsd:string”

maxOccurs=“1″ minOccurs=“0″>

</xsd:element>

<xsd:element name=“AccountingPeriodStartDate” type=“xsd:dateTime”

maxOccurs=“1″ minOccurs=“0″>

</xsd:element>

<xsd:element name=“TransactionDate” type=“xsd:dateTime”

maxOccurs=“1″ minOccurs=“0″>

</xsd:element>

<xsd:element name=“AccountingPeriodEndDate” type=“xsd:dateTime”

maxOccurs=“1″ minOccurs=“0″>

</xsd:element>

<xsd:element name=“CurrencyCode” type=“xsd:string”

maxOccurs=“1″ minOccurs=“1″>

</xsd:element>

<xsd:element name=“Payments” type=“tns:PaymentsType”

maxOccurs=“unbounded” minOccurs=“0″>

</xsd:element>

</xsd:sequence>

</xsd:complexType>

</xsd:element>

<xsd:complexType name=“PaymentsType”>

<xsd:sequence>

<xsd:element name=“paymentID” type=“xsd:string”

maxOccurs=“1″ minOccurs=“1″>

</xsd:element>

<xsd:element name=“paymentRef” type=“xsd:string”

maxOccurs=“1″ minOccurs=“0″>

</xsd:element>

</xsd:sequence>

</xsd:complexType>

</xsd:schema>

</wsdl:types>

<wsdl:message name=“GetPaymentDetailsRequest”>

<wsdl:part element=“tns:GetPaymentDetailsRequest” name=“parameters” />

</wsdl:message>

<wsdl:message name=“GetPaymentDetailsResponse”>

<wsdl:part element=“tns:GetPaymentDetailsResponse” name=“parameters” />

</wsdl:message>

<wsdl:message name=“GetExaminerPaymentsRequest”>

<wsdl:part name=“parameters” element=“tns:GetExaminerPaymentsRequest”>

</wsdl:part>

</wsdl:message>

<wsdl:message name=“GetExaminerPaymentsResponse”>

<wsdl:part name=“parameters” element=“tns:GetExaminerPaymentsResponse”>

</wsdl:part>

</wsdl:message>

<wsdl:portType name=“ExaminerManagementService”>

<wsdl:operation name=“GetPaymentDetails”>

<wsdl:input message=“tns:GetPaymentDetailsRequest” />

<wsdl:output message=“tns:GetPaymentDetailsResponse” />

</wsdl:operation>

<wsdl:operation name=“GetExaminerPayments”>

<wsdl:input message=“tns:GetExaminerPaymentsRequest”></wsdl:input>

<wsdl:output message=“tns:GetExaminerPaymentsResponse”></wsdl:output>

</wsdl:operation>

</wsdl:portType>

<wsdl:binding name=“ExaminerManagementServiceSOAP” type=“tns:ExaminerManagementService”>

<soap:binding style=“document”

transport=http://schemas.xmlsoap.org/soap/http&#8221; />

<wsdl:operation name=“GetPaymentDetails”>

<soap:operation

soapAction=http://www.nysolutionsltd.com/ExaminerManagementService/GetPaymentDetails&#8221; />

<wsdl:input>

<soap:body use=“literal” />

</wsdl:input>

<wsdl:output>

<soap:body use=“literal” />

</wsdl:output>

</wsdl:operation>

<wsdl:operation name=“GetExaminerPayments”>

<soap:operation

soapAction=http://www.nysolutionsltd.com/ExaminerManagementService/GetExaminerPaymentss&#8221; />

<wsdl:input>

<soap:body use=“literal” />

</wsdl:input>

<wsdl:output>

<soap:body use=“literal” />

</wsdl:output>

</wsdl:operation>

</wsdl:binding>

<wsdl:service name=“ExaminerManagementService”>

<wsdl:port binding=“tns:ExaminerManagementServiceSOAP” name=“ExaminerManagementServiceSOAP”>

<soap:address location=http://www.nysolutionsltd.com/&#8221; />

</wsdl:port>

</wsdl:service>

</wsdl:definitions>

Place the above file, named ExaminerManagementService.wsdl, in the directory ‘wsdl’ below the build.xml file. Run the WSDL2Java command via the ant task defined above, and there will be a directory called ‘output’ created. This directory contains the WSDL2Java generated source. An important detail is that an XMLBean class file is also generated by WSDL2Java, TypeSystemHolder.class. That file is placed into build/classes by the above ant task and will be needed to compile the generated sources. A frequent problem is users get an error such as:

ClassNotFoundException : Cannot load SchemaTypeSystem. Unable to load class with name schemaorg_apache_xmlbeans.system.s68C41DB812F52C975439BA10FE4FEE54.TypeSystemHolder. Make sure the generated binary files are on the classpath.

The TypeSystemHolder.class generated by WSDL2Java must be placed in your classpath in order to avoid this error.

The next step is to modify the generated Skeleton Java Source file – the Web service. This file as generated returns null and needs to be updated to contain the business logic.

After the WSDL2Java command runs the file ExaminerManagementService.wsdl, edit the following file:

output/org/example/types/ExaminerManagementServiceSkeleton.java. You should see the following code:

/**
* ExaminerManagementServiceSkeleton.java
*
* This file was auto-generated from WSDL
* by the Apache Axis2 version: 1.0-RC4 Apr 28, 2006 (05:23:23 IST)
*/
package org.example.types;
/**
*  ExaminerManagementServiceSkeleton java skeleton for the axisService
*/
public class ExaminerManagementServiceSkeleton {

/**
* Auto generated method signature

* @param param0

*/
public  login.types.ReturnWebLoginElementDocument webLogin
(login.types.WebLoginElementDocument param0 )

{
//Todo fill this with the necessary business logic
throw new  java.lang.UnsupportedOperationException();
}

}

Replace the contents of this file with the following, which uses the complex types generated by WSDL2Java and the example wsdl file:

/**
* ExaminerManagementServiceSkeleton.java
*
* This file was auto-generated from WSDL
* by the Apache Axis2 version: 1.0-RC4 Apr 28, 2006 (05:23:23 IST)
*/
package org.example.types;
import login.types.ReturnWebLoginElementDocument;
import login.types.ReturnWebLoginElementDocument.*;
import login.types.WebLoginElementDocument;
import login.types.WebLoginElementDocument.*;

/**
*  Auto generated java skeleton for the service by the Axis code generator
*/
public class ExaminerManagementServiceSkeleton {

/**
* Auto generated method signature

* @param webLoginElementDocument changed from param0

*/
public ReturnWebLoginElementDocument webLogin
(WebLoginElementDocument webLoginElementDocument ){

//Todo fill this with the necessary business logic
System.out.println(“ExaminerManagementServiceSkeleton.webLogin reached successfully!”);

// Get parameters passed in
WebLoginElement webLoginElement = webLoginElementDocument.getWebLoginElement();
String userName = webLoginElement.getUserNameElement();
String password = webLoginElement.getUserPasswordElement();
System.out.println(“ExaminerManagementServiceSkeleton.webLogin userName: ” + userName);
System.out.println(“ExaminerManagementServiceSkeleton.webLogin password: ” + password);

// input paramaters would be used here

// prepare output
ReturnWebLoginElementDocument retDoc =
ReturnWebLoginElementDocument.Factory.newInstance();

ReturnWebLoginElement retElement = ReturnWebLoginElement.Factory.newInstance();

retElement.setWebUserNameElement(“joe sixpack”);
retElement.setSoapSessionIdElement(“some_random_string”);
System.out.println(“validate retElement: ” + retElement.validate());

retDoc.setReturnWebLoginElement(retElement);
System.out.println(“validate retDoc: ” + retDoc.validate());

System.out.println(“ExaminerManagementServiceSkeleton.webLogin returning…”);

return retDoc;

}
}

The next steps assume the axis2.war has been deployed and has expanded in a servlet container.

Run the ‘jar_wsdl’ ant task from the example build.xml, which generates a jar file lib/axis2_example_wsdl.jar in the ‘lib’ directory under the build.xml . This jar will be used to compile the client, and also will be placed in the servlet container. Next, run the ‘aar’ ant task from the example build.xml, which generates the deployable axis2 Web service. Place dist/LoginEndpoint.aar into axis2/WEB-INF/services . Place lib/axis2_example_wsdl.jar into axis2/WEB-INF/lib . Verify the happy axis page loaded the services correctly – there should be the service ‘LoginEndpoint’ with the available operation ‘webLogin’ displayed.

The last step is to create and run the client. In the src directory create the file org.client.LoginClient.java, with the contents below:

package org.client;

import org.apache.axis2.AxisFault;

import login.types.ReturnWebLoginElementDocument;
import login.types.ReturnWebLoginElementDocument.*;
import login.types.WebLoginElementDocument;
import login.types.WebLoginElementDocument.*;
import org.example.types.ExaminerManagementServiceStub;

/**
* Login.
*
*/
public class LoginClient {

public static void main(String[] args) {
try {

System.out.println(“webLogin, firing…”);
ExaminerManagementServiceStub stub = new ExaminerManagementServiceStub();

WebLoginElementDocument webLoginElementDocument
= WebLoginElementDocument.Factory.newInstance();
WebLoginElement webLoginElement =
WebLoginElement.Factory.newInstance();
webLoginElement.setUserNameElement(“joe”);
webLoginElement.setUserPasswordElement(“sixpack”);

webLoginElementDocument.setWebLoginElement(webLoginElement);

System.out.println(“validate: ” +  webLoginElement.validate());
stub.webLogin(webLoginElementDocument);

ReturnWebLoginElementDocument returnWebLoginElementDocument =
stub.webLogin(webLoginElementDocument);

System.out.println(“Client returned”);

ReturnWebLoginElementDocument.ReturnWebLoginElement
retElement = returnWebLoginElementDocument.getReturnWebLoginElement();

System.out.println(“WebUserName: ” + retElement.getWebUserNameElement());
System.out.println(“SOAPSessionId: ” + retElement.getSoapSessionIdElement());
System.out.println(“webLogin, completed!!!”);

} catch (AxisFault axisFault) {
axisFault.printStackTrace();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}

Now run the ant task ‘ant runLogin’ . The following output should appear:

runLogin:
[echo] running the webLogin client
[java] webLogin, firing…
[java] validate: true
[java] Client returned
[java] WebUserName: joe sixpack
[java] SOAPSessionId: some_random_string
[java] webLogin, completed!!!

Restful Web services with OSB


I have been working on SOAP webserivces for some time, but never really used REST services with OSB up untill recently.

I thought it would be useful to add a new post on to my blog to help users who like me are trying to hook their REST services with OSB and then may be trying to expose as a SOAP webservice. I will be covering both aspects

1. Calling Restful services from OSB.

2. Creating Restful services using OSB.

I have taken an example of the Google Geocoding service for this.

http://code.google.com/apis/maps/documentation/geocoding/

What is does is takes in an address and gives you long & lat for that place and vice versa.

This is a rest service and the request format is

http://maps.googleapis.com/maps/api/geocode/xml?address=Harrow%20HA2%200ET&sensor=false

Oracle have now added several examples on this topic on the examples page.

The link to the same is at http://java.net/projects/oraclesoasuite11g/pages/OSB

Hope you guys will find them useful.

Rajesh Raheja on Enterprise Software Development

My thoughts on Enterprise Software Technologies...and more.

Gilberto Holms

Java/SOA Architecture Blog

Universo Middleware

"Não é a agilidade da resposta que ficará marcada para sempre como o seu atributo mais forte, é a qualidade e a profundidade do que você está dizendo."

Enjoy IT - SOA, Java, Event-Driven Computing and Integration

Sharing my thoughts and experiences on SOA, Java in the Enterprise, Event-Driven Computing and Integration in the Enterprise

Oracle Technologies Premier

Technical posts on OSB/WLS/AIA, Oracle SOA Suite, BPM and Fusion Middleware

Java på svenska

Just another WordPress.com weblog

SOA Community Blog

by Jürgen Kress

Oracle .. Java .. OpenSource .. SOA

Just another WordPress.com weblog

Nitin's Oracle Fusion Middleware and SOA World

SOA FMW BPM BPEL OSB Governance J2EE and all the Geeky stuff

%d bloggers like this: