Вы находитесь на странице: 1из 27

1.

WebService Module\

The Web Service application is a collection of services that accelerate the use of common
functionalities of integration-based business capabilities.


Step1: Go to File>New>Other
















Step2: Go to WebLogicWebService>WebServiceProject
Provide Project name and check add to EAR. Provide EAR name. Click Finish.
















Step3: Right Click on the WebService Project then New>other>WSDL

































Step4: In the active window select WSDL and click on next

























Step5: Expand WebService Project > select WebContent > provide WSDL name and click on next



















Step6: In the Target namespace provide package name and click on finish



















Step7: Now WebService Looks like this






Step8: Double click on operation name




Step9: Type the proper operation name and click on the right arrow to edit input parameters









Step10: Double click on the element name and type proper element name> select new from the drop
down


Step11: Make the type complex and provide name>OK


















Step12: Click on source view





Step13: Click on Design View











Step14: WSDL now looks like the following



Step15: Right click on AddCustDetailsType > Add Element















Step16: Provide Element Name




Step17: Add all required element by repeating step 15 and 16




Step18: Now Right Click on (AddCustomerType) > Add Element



Step19: Provide the next element name in similar way



Step20: Add elements in similar way

























Step21: Add all required types and elements in same way







Step22: Now click on Right arrow to add response parameter








Step23: Add element and element name for response




Step24: Right click on the Customer Operation to add Delete Operation




Step25: Add Delete Operation



Step26: Provide required request parameters




Step27: Provide required response parameter








Step28: Right click on the Binding icon> Generate Binding Content..




Step29: Check Overwrite existing binding information > finish and save the changes














1.1 WSDL Source View









































<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://services.com/CustomerSolution/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="CustomerSolution"
targetNamespace="http://services.com/CustomerSolution/">
<wsdl:types>
<xsd:schema targetNamespace="http://services.com/CustomerSolution/">
<xsd:element name="AddCustomer">
<xsd:complexType>
<xsd:sequence>
<xsd:elementname="AddCustDetails"type="tns:AddCustDetailsType" />
<xsd:element name="AddressDetails"type="tns:AddressDetailsType"></xsd:element>
<xsd:element name="DegreeDetails" type="tns:DegreeDetailsType"></xsd:element>
<xsd:element name="LicenseDetails" type="tns:LicenseDetailsType"></xsd:element>
<xsd:element name="SpecialtyDetails" type="tns:SpecialtyDetailsType"></xsd:element>
<xsd:element name="AdditionalInfoDetails"
type="tns:AdditionalInfoDetailsType"></xsd:element>
<xsd:element name="CommunicationDetails"
type="tns:CommunicationDetailsType"></xsd:element>
</xsd:sequence> </xsd:complexType></xsd:element>
<xsd:element name="AddCustomerResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Status" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="AddCustDetailsType">
<xsd:sequence>
<xsd:element name="FirstName" type="xsd:string"></xsd:element>
<xsd:element name="LastName" type="xsd:string"></xsd:element>
<xsd:element name="Age" type="xsd:string"></xsd:element>
<xsd:element name="Gender" type="xsd:string"></xsd:element>
<xsd:element name="CustType" type="xsd:string"></xsd:element>
<xsd:element name="OrgName" type="xsd:string"></xsd:element>
<xsd:element name="CustId" type="xsd:string"></xsd:element>
</xsd:sequence></xsd:complexType>
<xsd:complexType name="AddressDetailsType">
<xsd:sequence>
<xsd:element name="AddressLine1" type="xsd:string"></xsd:element>
<xsd:element name="AddressLine2" type="xsd:string"></xsd:element>
<xsd:element name="AddressLine3" type="xsd:string"></xsd:element>
<xsd:element name="City" type="xsd:string"></xsd:element>
<xsd:element name="AddressType" type="xsd:string"></xsd:element>
<xsd:element name="CustId" type="xsd:string"></xsd:element>
<xsd:element name="ValidAddressInd" type="xsd:string"></xsd:element>
<xsd:element name="ProvinceCode" type="xsd:string"></xsd:element>
<xsd:element name="PostalCode" type="xsd:string"></xsd:element>
<xsd:element name="PostalCodeExtn" type="xsd:string"></xsd:element>
<xsd:element name="CountryCode" type="xsd:string"></xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="DegreeDetailsType">

























































<xsd:complexType name="LicenseDetailsType">
<xsd:sequence>
<xsd:element name="CustId" type="xsd:string"></xsd:element>
<xsd:element name="ProvinceCode" type="xsd:string"></xsd:element>
<xsd:element name="LicenseCode" type="xsd:string"></xsd:element>
<xsd:element name="LicenseNumber" type="xsd:string"></xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="SpecialtyDetailsType">
<xsd:sequence>
<xsd:element name="CustId" type="xsd:string"></xsd:element>
<xsd:element name="SpecialtyCode" type="xsd:string"></xsd:element>
<xsd:element name="SpecialtyValue"
type="xsd:string"></xsd:element>
<xsd:element name="CountryCode" type="xsd:string"></xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="AdditionalInfoDetailsType">
<xsd:sequence>
<xsd:element name="CustId" type="xsd:string"></xsd:element>
<xsd:element name="MaritalStatus" type="xsd:string"></xsd:element>
<xsd:element name="PassportNumber"
type="xsd:string"></xsd:element>
<xsd:element name="SSNNumber" type="xsd:string"></xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CommunicationDetailsType">
<xsd:sequence>
<xsd:element name="CustId" type="xsd:string"></xsd:element>
<xsd:element name="CommunicationType"
type="xsd:string"></xsd:element>
<xsd:element name="CommunicationValue"
type="xsd:string"></xsd:element>
<xsd:element name="CommunicationExtValue"
type="xsd:string"></xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="DeleteCustomer">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="SourceKey" type="xsd:string"></xsd:element>
<xsd:element name="SourceSystemName"
type="xsd:string"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="DeleteCustomerResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Status"
type="xsd:string"></xsd:element>























































<wsdl:message name="AddCustomerRequest">
<wsdl:part element="tns:AddCustomer" name="parameters"/>
</wsdl:message>
<wsdl:message name="AddCustomerResponse">
<wsdl:part element="tns:AddCustomerResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="DeleteCustomerRequest">
<wsdl:part name="parameters" element="tns:DeleteCustomer"></wsdl:part>
</wsdl:message>
<wsdl:message name="DeleteCustomerResponse">
<wsdl:part name="parameters"
element="tns:DeleteCustomerResponse"></wsdl:part>
</wsdl:message>
<wsdl:portType name="CustomerSolution">
<wsdl:operation name="AddCustomer">
<wsdl:input message="tns:AddCustomerRequest"/>
<wsdl:output message="tns:AddCustomerResponse"/>
</wsdl:operation>
<wsdl:operation name="DeleteCustomer">
<wsdl:input message="tns:DeleteCustomerRequest"></wsdl:input>
<wsdl:output message="tns:DeleteCustomerResponse"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CustomerSolutionSOAP" type="tns:CustomerSolution">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="AddCustomer">
<soap:operation
soapAction="http://services.com/CustomerSolution/AddCustomer" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="DeleteCustomer">
<soap:operation

soapAction="http://services.com/CustomerSolution/DeleteCustomer" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="CustomerSolution">
<wsdl:port binding="tns:CustomerSolutionSOAP" name="CustomerSolutionSOAP">
<soap:address location="http://www.example.org/"/>
</wsdl:port>
</wsdl:service>













1.2 Add fault in WSDL
Add fault in WSDL to handle exceptions.

Step1: Right click > Add Fault




Step2: WSDL looks like this



Step3: Go to source view and replace the left hand side code with right hand side this makes the
exception type as customer profile fault










<xsd:element name="AddCustomerFault">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="AddCustomerFault"
type="xsd:string">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="CustomerProfileFault">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ExceptionMessage"
type="xsd:string">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>












Step4: WSDL looks like this





Step5: Similar way add another fault System Fault from source view

























Step6: Similar way add faults to delete operation also

<wsdl:fault name="fault"
message="tns:AddCustomerFault">
</wsdl:fault>

<wsdl:fault name="CustomerProfileFault"
message="tns:CustomerProfileFault">
</wsdl:fault>
<wsdl:message name="AddCustomerFault">
<wsdl:part name="parameters"
element="tns:AddCustomerFault">
</wsdl:part>
</wsdl:message>
<wsdl:message name="CustomerProfileFault">
<wsdl:part name="parameters"
element="tns:CustomerProfileFault">
</wsdl:part>
</wsdl:message>
<wsdl:message name="SystemFault">
<wsdl:part name="parameters"
element="tns:SystemFault">
</wsdl:part>
</wsdl:message>
<wsdl:fault name="SystemFault"
message="tns:SystemFault">
</wsdl:fault>
<xsd:element name="SystemFault">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ExceptionMessage"
type="xsd:string">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
















Step7: Save the configuration changes








<wsdl:operation name="DeleteCustomer">
<wsdl:input message="tns:DeleteCustomerRequest"></wsdl:input>
<wsdl:output message="tns:DeleteCustomerResponse"></wsdl:output>
<wsdl:fault name="CustomerProfileFault" message="tns:CustomerProfileFault">
</wsdl:fault>
<wsdl:fault name="SystemFault" message="tns:SystemFault">
</wsdl:fault>
</wsdl:operation>











1.3 WSDL to java
Now a java class has to be created from WSDL.

Step1: Right click on WSDL> new>other





















Step2: WebLogic Web Service > Web Service from WSDL > next

























Step3: Select CustomerSolution.wsdl > next

























Step4: Check keep generated Ant script > finish

























One class CustomerSolution_CustomerSolutionSOAPImpl.java is created inside the
package, whose name was provided during wsdl creation. One jar CustomerSolution_wsdl.jar also
created inside WebContent>WEB-INF>lib.