You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by אלחנן מעיין <El...@fnx.co.il> on 2009/01/06 12:17:12 UTC

replacing current web service framwork with axis2 - custom type Mapping issue

Hi..

 

We are in the midst  of replacing out current web service framework with glue. 

 

Our problem is this, glue, was very simple to use, all it needed was wsdl, and it generated input and output objects to use, it had a dynamic proxy created on runtime, where you could send such objects  and receive the populated generated ones.

 

I cannot see this happening in axis2, for example say that I have this wsdl:

<?xml version="1.0" encoding="utf-16"?>

<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://Phoenix.co.il/UnderWrite" xmlns:s1="http://Phoenix.ESB.Hitum.Schemas.GreenSystemServices.Agent.AgentWSResponse" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://Phoenix.co.il/UnderWrite" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

  <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">BizTalk assembly "Phoenix.ESB.UnderWrite.Biztalk, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3b97ca913d728b36" published web service.</wsdl:documentation>

  <wsdl:types>

    <s:schema elementFormDefault="qualified" targetNamespace="http://Phoenix.co.il/UnderWrite">

      <s:import namespace="http://Phoenix.ESB.Hitum.Schemas.GreenSystemServices.Agent.AgentWSResponse" />

      <s:element name="GetAgentDetails">

        <s:complexType>

          <s:sequence>

            <s:element minOccurs="0" maxOccurs="1" name="part" type="tns:AgentWSRequest" />

          </s:sequence>

        </s:complexType>

      </s:element>

      <s:complexType name="AgentWSRequest">

        <s:sequence>

          <s:element minOccurs="1" maxOccurs="1" form="unqualified" name="AgentNumber" type="s:int" />

        </s:sequence>

      </s:complexType>

      <s:element name="GetAgentDetailsResponse">

        <s:complexType>

          <s:sequence>

            <s:element minOccurs="0" maxOccurs="1" ref="s1:AgentWSResponse" />

          </s:sequence>

        </s:complexType>

      </s:element>

    </s:schema>

    <s:schema elementFormDefault="qualified" targetNamespace="http://Phoenix.ESB.Hitum.Schemas.GreenSystemServices.Agent.AgentWSResponse">

      <s:element name="AgentWSResponse" type="s1:AgentWSResponse" />

      <s:complexType name="AgentWSResponse">

        <s:sequence>

          <s:element minOccurs="1" maxOccurs="1" form="unqualified" name="ResponseCode" type="s:short" />

          <s:element minOccurs="0" maxOccurs="1" form="unqualified" name="ResponseDescription" type="s:string" />

          <s:element minOccurs="0" maxOccurs="1" form="unqualified" name="AgentName" type="s:string" />

          <s:element minOccurs="1" maxOccurs="1" form="unqualified" name="CancelledDate" type="s:date" />

          <s:element minOccurs="0" maxOccurs="1" form="unqualified" name="Street" type="s:string" />

          <s:element minOccurs="0" maxOccurs="1" form="unqualified" name="HouseNumber" type="s:string" />

          <s:element minOccurs="0" maxOccurs="1" form="unqualified" name="City" type="s:string" />

          <s:element minOccurs="1" maxOccurs="1" form="unqualified" name="ZipCode" type="s:int" />

          <s:element minOccurs="1" maxOccurs="1" form="unqualified" name="AreaCode" type="s:short" />

          <s:element minOccurs="1" maxOccurs="1" form="unqualified" name="PhoneNumber" type="s:int" />

          <s:element minOccurs="1" maxOccurs="1" form="unqualified" name="AreaCode2" type="s:short" />

          <s:element minOccurs="1" maxOccurs="1" form="unqualified" name="PhoneNumber2" type="s:int" />

          <s:element minOccurs="1" maxOccurs="1" form="unqualified" name="InspectorNumber" type="s:short" />

          <s:element minOccurs="1" maxOccurs="1" form="unqualified" name="SuperInspectorNumber" type="s:short" />

          <s:element minOccurs="1" maxOccurs="1" form="unqualified" name="StaffNumber" type="s:short" />

          <s:element minOccurs="1" maxOccurs="1" form="unqualified" name="AgenceNumber" type="s:int" />

          <s:element minOccurs="0" maxOccurs="1" form="unqualified" name="StaffName" type="s:string" />

          <s:element minOccurs="0" maxOccurs="1" form="unqualified" name="EmployeeNumber" type="s:string" />

          <s:element minOccurs="0" maxOccurs="1" form="unqualified" name="ProductionConfirmCode" type="s:string" />

          <s:element minOccurs="1" maxOccurs="1" form="unqualified" name="AddProductionLifePolicy" type="s:short" />

          <s:element minOccurs="1" maxOccurs="1" form="unqualified" name="AddProductionHealthPolicy" type="s:short" />

          <s:element minOccurs="0" maxOccurs="1" form="unqualified" name="AddLoginEmployee1" type="s:string" />

          <s:element minOccurs="0" maxOccurs="1" form="unqualified" name="AddLoginEmployee2" type="s:string" />

          <s:element minOccurs="0" maxOccurs="1" form="unqualified" name="Result" type="s1:AgentWSResponseResult" />

        </s:sequence>

      </s:complexType>

      <s:complexType name="AgentWSResponseResult">

        <s:sequence>

          <s:element minOccurs="1" maxOccurs="1" form="unqualified" name="Code" type="s:int" />

          <s:element minOccurs="0" maxOccurs="1" form="unqualified" name="Description" type="s:string" />

        </s:sequence>

      </s:complexType>

    </s:schema>

  </wsdl:types>

  <wsdl:message name="GetAgentDetailsSoapIn">

    <wsdl:part name="parameters" element="tns:GetAgentDetails" />

  </wsdl:message>

  <wsdl:message name="GetAgentDetailsSoapOut">

    <wsdl:part name="parameters" element="tns:GetAgentDetailsResponse" />

  </wsdl:message>

  <wsdl:portType name="Phoenix_ESB_UnderWrite_Biztalk_AgentDetails_4405_AgentDetails_PrtSoap">

    <wsdl:operation name="GetAgentDetails">

      <wsdl:input message="tns:GetAgentDetailsSoapIn" />

      <wsdl:output message="tns:GetAgentDetailsSoapOut" />

    </wsdl:operation>

  </wsdl:portType>

  <wsdl:binding name="Phoenix_ESB_UnderWrite_Biztalk_AgentDetails_4405_AgentDetails_PrtSoap" type="tns:Phoenix_ESB_UnderWrite_Biztalk_AgentDetails_4405_AgentDetails_PrtSoap">

    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />

    <wsdl:operation name="GetAgentDetails">

      <soap:operation soapAction="http://Phoenix.co.il/UnderWrite/Phoenix_ESB_UnderWrite_Biztalk_AgentDetails_4405_AgentDetails_Prt/GetAgentDetails" style="document" />

      <wsdl:input>

        <soap:body use="literal" />

      </wsdl:input>

      <wsdl:output>

        <soap:body use="literal" />

      </wsdl:output>

    </wsdl:operation>

  </wsdl:binding>

  <wsdl:binding name="Phoenix_ESB_UnderWrite_Biztalk_AgentDetails_4405_AgentDetails_PrtSoap12" type="tns:Phoenix_ESB_UnderWrite_Biztalk_AgentDetails_4405_AgentDetails_PrtSoap">

    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />

    <wsdl:operation name="GetAgentDetails">

      <soap12:operation soapAction="http://Phoenix.co.il/UnderWrite/Phoenix_ESB_UnderWrite_Biztalk_AgentDetails_4405_AgentDetails_Prt/GetAgentDetails" style="document" />

      <wsdl:input>

        <soap12:body use="literal" />

      </wsdl:input>

      <wsdl:output>

        <soap12:body use="literal" />

      </wsdl:output>

    </wsdl:operation>

  </wsdl:binding>

  <wsdl:service name="Phoenix_ESB_UnderWrite_Biztalk_AgentDetails_4405_AgentDetails_Prt">

    <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">BizTalk assembly "Phoenix.ESB.UnderWrite.Biztalk, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3b97ca913d728b36" published web service.</wsdl:documentation>

    <wsdl:port name="Phoenix_ESB_UnderWrite_Biztalk_AgentDetails_4405_AgentDetails_PrtSoap" binding="tns:Phoenix_ESB_UnderWrite_Biztalk_AgentDetails_4405_AgentDetails_PrtSoap">

      <soap:address location="http://btsp2006/UnderWrite.Biztalk.Proxy/Phoenix_ESB_UnderWrite_Biztalk_AgentDetails_4405_AgentDetails_Prt.asmx" />

    </wsdl:port>

    <wsdl:port name="Phoenix_ESB_UnderWrite_Biztalk_AgentDetails_4405_AgentDetails_PrtSoap12" binding="tns:Phoenix_ESB_UnderWrite_Biztalk_AgentDetails_4405_AgentDetails_PrtSoap12">

      <soap12:address location="http://btsp2006/UnderWrite.Biztalk.Proxy/Phoenix_ESB_UnderWrite_Biztalk_AgentDetails_4405_AgentDetails_Prt.asmx" />

    </wsdl:port>

  </wsdl:service>

</wsdl:definitions>

 

 

The closest thing I could do is this code:

 

AgentWSRequest agentWSRequest=new AgentWSRequest();                     

            agentWSRequest.AgentNumber=8888;                

            ServiceClient client=new ServiceClient(null,new URL(wsdl),null,null);               

            final String ns = "http://Phoenix.co.il/UnderWrite";

            final String operation = "GetAgentDetails";

            final String partName = "part";

            final OMElement element = BeanUtil.getOMElement(new QName(ns,operation), new Object[]{agentWSRequest}, new QName(ns,partName), false, null);               

            System.out.println(element);        

            OMElement sendReceive = client.sendReceive(new QName(operation), element);          

            System.out.println(sendReceive);

 

The modifications I had to do 

Add a getter method for the request method (glue didn't generate these) 

Provide the name space (we didn't need that before)

Provide the part name (didn't need that as well)

 

Also I have no idea I would I map dynamically, the response OMElement to response bean, we need something generic, because the axis2 would be wrapped in our custom application framework.