cancel
Showing results for 
Search instead for 
Did you mean: 

Create MII transaction & MII Web Service and consume them in ABAP

Former Member
0 Kudos

Hi,

there is a document from Pradip Ray (SAP Labs India) published on SDN:

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/208239ac-3161-2b10-f29a-abec6754...

He explains how to build a transaction in MII, expose it as a web service then consume it in an ABAP program by generating a ABAP consumer proxy for this service.

I have done this and it works but the problems started when I tried to generate a second ABAP consumer proxy for a second web service build in MII.

In the ABAP system , transaction SE80 then display proxy class: ( e.g. ZMIICO_XACUTE_WSSOAP )

then go to Properties tab , under sub-screen "External key" you can see the "Name: XacuteWSSoap".

This is the web service port type name generated at MII and is always the same for all the MII web services. When you try to generate a second proxy for a second MII web service you get the following message "A proxy already exists for object XacuteWSSoap (namespace http://www.sap.com/xMII) "

This can be changed by editing the WSDL file but then another problem occurs which is related to the "InputParams" complex type. This tag gets generated with the same name for all the web services in MII. The generation of the ABAP structure with the following name: INPUT_PARAMS will override the previous one . This means that the previous ABAP proxy will not work anymore.

Has any one experimented this ?

Daryoush Delgari.

This is the generated WSDL on MII:

<?xml version="1.0" encoding="UTF-8" ?>

- <definitions targetNamespace="http://www.sap.com/xMII" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://www.sap.com/xMII" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">

- <!-- Types

-->

- <types>

- <s:schema elementFormDefault="qualified" targetNamespace="http://www.sap.com/xMII">

+ <s:complexType name="InputParams">

- <s:sequence id="InputSequence">

<s:element maxOccurs="1" minOccurs="0" name="FromDate" type="s:string" />

<s:element maxOccurs="1" minOccurs="0" name="PLANT" type="s:string" />

<s:element maxOccurs="1" minOccurs="0" name="ToDate" type="s:string" />

</s:sequence>

</s:complexType>

- <s:element name="XacuteRequest">

- <s:complexType>

- <s:sequence>

<s:element maxOccurs="1" minOccurs="0" name="LoginName" type="s:string" />

<s:element maxOccurs="1" minOccurs="0" name="LoginPassword" type="s:string" />

<s:element maxOccurs="1" minOccurs="0" name="InputParams" type="s0:InputParams" />

</s:sequence>

</s:complexType>

</s:element>

- <s:complexType name="Rowset">

- <s:sequence>

<s:element maxOccurs="unbounded" minOccurs="0" name="Row" type="s0:Row" />

</s:sequence>

<s:attribute name="Message" type="s:string" />

</s:complexType>

- <s:complexType name="Row">

- <s:sequence id="RowSequence">

<s:element maxOccurs="1" minOccurs="1" name="Day" type="s:string" />

<s:element maxOccurs="1" minOccurs="1" name="Item" type="s:string" />

<s:element maxOccurs="1" minOccurs="1" name="Resource" type="s:string" />

<s:element maxOccurs="1" minOccurs="1" name="WorkCenter" type="s:string" />

<s:element maxOccurs="1" minOccurs="1" name="ShopOrder" type="s:string" />

<s:element maxOccurs="1" minOccurs="1" name="OrderQty" type="s:long" />

<s:element maxOccurs="1" minOccurs="1" name="Cured" type="s:long" />

</s:sequence>

</s:complexType>

- <s:element name="XacuteResponse">

- <s:complexType>

+ <s:sequence>

<s:element maxOccurs="1" minOccurs="0" name="Rowset" type="s0:Rowset" />

</s:sequence>

</s:complexType>

</s:element>

</s:schema>

</types>

- <!-- Messages

-->

- <message name="XacuteSoapIn">

<part element="s0:XacuteRequest" name="parameters" />

</message>

- <message name="XacuteSoapOut">

<part element="s0:XacuteResponse" name="parameters" />

</message>

- <!-- Ports

-->

- <portType name="XacuteWSSoap">

- <operation name="Xacute">

<input message="s0:XacuteSoapIn" />

<output message="s0:XacuteSoapOut" />

</operation>

</portType>

- <!-- Bindings

-->

- <binding name="XacuteWSSoap" type="s0:XacuteWSSoap">

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

- <operation name="Xacute">

<soap:operation soapAction="http://www.sap.com/xMII" style="document" />

- <input>

<soap:body use="literal" />

</input>

- <output>

<soap:body use="literal" />

</output>

</operation>

</binding>

- <!-- Service mapping

-->

- <service name="XacuteWS">

- <port binding="s0:XacuteWSSoap" name="XacuteWSSoap">

<soap:address location="http://<host>:port/XMII/SOAPRunner/Default/Amrik/Wolves/WDPro/getCuresByPeriod" />

</port>

</service>

</definitions>

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member186078
Active Participant
0 Kudos

Hi Daryoush,

      We faced similar kind of problem. Here is what the final solution we have approached. On the ABAP Backend side, we have created a Super package. Under which, we have created sub-packages for the proxy objects.

      Here is an example for what we did:

      Consider ZPROXY_MAIN as the main package created and we need two proxy objects to be created on the Backend side, so we have created two sub packages

      ZPACK_PR1, ZPACK_PR2.

      For proxy object 1, we have CONSUMED the MII WSDL and created the object with prefix ZP01 under ZPACK_PR1 package.

     Similarly for second proxy object, we have consumed the MII WSDl and created the object with prefix ZP02 in ZPACK_PR2 package.

     We are following this as the standard process and till now didnt face any issues with this approach.

      Let me know if you need more information.

Thanks,

Adithya K

olivier_thiry
Participant
0 Kudos

Hi Daryoush,

Little surprise for you, I got the solution ;o)

In fact, editing the WDSL file, you can change the parameter names which will be generated in Web Dynpro. You have to change the tag <complex type ...>.

For example :

<s:complexType name="InputParams">

Could become :

<s:complexType name="*Zs1*InputParams">

and later in the code, you should reference the element appropriately

<s:element maxOccurs="1" minOccurs="0" name="InputParams" type="s0:InputParams"/>

should become :

<s:element maxOccurs="1" minOccurs="0" name="InputParams" type="s0:*Zs1*InputParams"/>

But take care to keep name="InputParams", it's the xlm name which will be used by MII to do the matching...

Take care also that you have to do the same for output, that means ROW and ROWSET complex type...

So, to be concrete, here are an example with in bold everything I changed against the original MII WDL file...

<?xml version="1.0" encoding="UTF-8"?>

<definitions targetNamespace="http://www.sap.com/xMII" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://www.sap.com/xMII" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">

<!-- Types -->

<types>

<s:schema elementFormDefault="qualified" targetNamespace="http://www.sap.com/xMII">

<s:complexType name="*Zs1*InputParams">

<s:sequence id="InputSequence">

<s:element maxOccurs="1" minOccurs="0" name="inputItem" type="s:string"/>

<s:element maxOccurs="1" minOccurs="0" name="inputPlant" type="s:string"/>

<s:element maxOccurs="1" minOccurs="0" name="inputSearchBy" s:long"/>

</s:sequence>

</s:complexType>

<s:element name="XacuteRequest">

<s:complexType>

<s:sequence>

<s:element maxOccurs="1" minOccurs="0" name="LoginName" type="s:string"/>

<s:element maxOccurs="1" minOccurs="0" name="LoginPassword" type="s:string"/>

<s:element maxOccurs="1" minOccurs="0" name="InputParams" type="s0:*Zs1*InputParams"/>

</s:sequence>

</s:complexType>

</s:element>

<s:complexType name="*Zs1*Rowset">

<s:sequence>

<s:element maxOccurs="unbounded" minOccurs="0" name="Row" type="s0:*Zs1*Row"/>

</s:sequence>

<s:attribute name="Message" type="s:string"/>

</s:complexType>

<s:complexType name="*Zs1*Row">

<s:sequence id="RowSequence">

<s:element maxOccurs="1" minOccurs="1" name="Item" type="s:string"/><s:element maxOccurs="1" minOccurs="1" name="ItemDescription" type="s:string"/></s:sequence>

</s:complexType>

<s:element name="XacuteResponse">

<s:complexType>

<s:sequence>

<s:element maxOccurs="1" minOccurs="0" name="Rowset" type="s0:*Zs1*Rowset"/>

</s:sequence>

</s:complexType>

</s:element>

</s:schema>

</types>

<!-- Messages -->

<message name="Xacute*Zs1*In">

<part element="s0:XacuteRequest" name="parameters"/>

</message>

<message name="Xacute*Zs1*Out">

<part element="s0:XacuteResponse" name="parameters"/>

</message>

<!-- Ports -->

<portType name="Xacute*MyTest*">

<operation name="Xacute">

<input message="s0:Xacute*Zs1*In"/>

<output message="s0:Xacute*Zs1*Out"/>

</operation>

</portType>

<!-- Bindings -->

<binding name="Xacute*MyTest*" type="s0:Xacute*MyTest*">

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

<operation name="Xacute">

<soap:operation soapAction="http://www.sap.com/xMII" style="document"/>

<input>

<soap:body use="literal"/>

</input>

<output>

<soap:body use="literal"/>

</output>

</operation>

</binding>

<!-- Service mapping -->

<service name="XacuteWS">

<port binding="s0:XacuteMyTest" name="XacuteMyTest">

<soap:address location="http://host/XMII/SOAPRunner/Development/WebServices/GetItems/getItemsTrx"/>

</port>

</service>

</definitions>

If you want a demo, you can come to my desk ;o)

Edited by: Olivier Thiry on Mar 12, 2009 1:02 PM

Damned, the bold tag seems not to work... So all my changes are between star (..)

Former Member
0 Kudos

Hi Olivier Thiry, I am also using this solution and now I am editing some WDSL files.

Have this solution brought some issue to you after some time in production ?

olivier_thiry
Participant
0 Kudos

Hi Michel,

In fact, we never implemented this in production, as we switched from ABAP stack to Java stack under recommendations of SAP.

So we finally used Java Webdynpro application.

Regards

Olivier