cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Converting Webservice response to SAP MII XML format

Former Member
0 Likes
382

Hi,

Please suggest me a better way to convert WSDL response to MII XML format. I run a MII transaction as a webservice, and the Xacute response XML does not have column definitions. My requirement is to convert it back to MII XML format for which I have implemented the logic, but I dont see a way to get the data type of each column. Please suggest me a way to do this.

Thanks!

Ajitha

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Likes

Ajitha,

you get a xml response from WSDL, so you have node names in it. Can you evaluate the data type from the node names? So you can built a MII XML doc using the XMI document action and linking the WSDL values in it.

Or do you have problems because the WSDL response can have different kinds of contents (numbers, strings), and you need a function to get the column type? As an alternative, is it possible to handle the column values as strings?

Michael

Former Member
0 Likes

Michael,

I tried creating the MII XML format, using the document action.

Here is a summary of what I did. I created a column xml that contains column name and datatype using a xslt on the webservice response. In that way I dont have to worry even if the underlying query returns additional columns in future. I have hardcoded the datatype as "1" now. I pass this column XML and the Webservice response to a transaction that creates the MII XML.

This transaction has a empty document. I add columns, looping on columnXML. And then I add rows and data item, looping on webservice response.

The Output XML is in MII format now, except that the datatype of all columns is "1". Handling the column values as string can create problems during manipulation, that would be the last option for me to think of..

This is what I want....

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

<Rowsets>

<Rowset>

<Columns>

<Column Description="LEVEL_ID" MaxRange="1" MinRange="0" Name="LEVEL_ID" SQLDataType="12" SourceColumn="LEVEL_ID" />

<Column Description="DRIVING_BATCH_NUMBER" MaxRange="1" MinRange="0" Name="DRIVING_BATCH_NUMBER" SQLDataType="12" SourceColumn="DRIVING_BATCH_NUMBER" />

<Column Description="LEVEL_0_BATCH_NUMBER" MaxRange="1" MinRange="0" Name="LEVEL_0_BATCH_NUMBER" SQLDataType="12" SourceColumn="LEVEL_0_BATCH_NUMBER" />

<Column Description="BATCH_NUMBER" MaxRange="1" MinRange="0" Name="BATCH_NUMBER" SQLDataType="12" SourceColumn="BATCH_NUMBER" />

<Column Description="MANUFACTURE_DATE" MaxRange="1" MinRange="0" Name="MANUFACTURE_DATE" SQLDataType="93" SourceColumn="MANUFACTURE_DATE" />

<Column Description="USAGE_DECISION" MaxRange="1" MinRange="0" Name="USAGE_DECISION" SQLDataType="12" SourceColumn="USAGE_DECISION" />

<Column Description="QAD_DATE" MaxRange="1" MinRange="0" Name="QAD_DATE" SQLDataType="93" SourceColumn="QAD_DATE" />

<Column Description="EXPIRATION_DATE" MaxRange="1" MinRange="0" Name="EXPIRATION_DATE" SQLDataType="93" SourceColumn="EXPIRATION_DATE" />

</Columns>

</Rowset>

</Rowsets>

And this is what I get now....

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

<Rowsets>

<Rowset>

<Columns>

<Column Description="LEVEL_ID" MaxRange="1" MinRange="0" Name="LEVEL_ID" SQLDataType="1" SourceColumn="LEVEL_ID" />

<Column Description="DRIVING_BATCH_NUMBER" MaxRange="1" MinRange="0" Name="DRIVING_BATCH_NUMBER" SQLDataType="1" SourceColumn="DRIVING_BATCH_NUMBER" />

<Column Description="LEVEL_0_BATCH_NUMBER" MaxRange="1" MinRange="0" Name="LEVEL_0_BATCH_NUMBER" SQLDataType="1" SourceColumn="LEVEL_0_BATCH_NUMBER" />

<Column Description="BATCH_NUMBER" MaxRange="1" MinRange="0" Name="BATCH_NUMBER" SQLDataType="1" SourceColumn="BATCH_NUMBER" />

<Column Description="MANUFACTURE_DATE" MaxRange="1" MinRange="0" Name="MANUFACTURE_DATE" SQLDataType="1" SourceColumn="MANUFACTURE_DATE" />

<Column Description="USAGE_DECISION" MaxRange="1" MinRange="0" Name="USAGE_DECISION" SQLDataType="1" SourceColumn="USAGE_DECISION" />

<Column Description="QAD_DATE" MaxRange="1" MinRange="0" Name="QAD_DATE" SQLDataType="1" SourceColumn="QAD_DATE" />

<Column Description="EXPIRATION_DATE" MaxRange="1" MinRange="0" Name="EXPIRATION_DATE" SQLDataType="1" SourceColumn="EXPIRATION_DATE" />

</Columns>

</Rowset>

</Rowsets>

Thank you for your response...

Ajitha

Former Member
0 Likes

I think it is a good idea to extract the column names from the Web response and use them with the Column action.

If the Web response does not deliver the data type, you have to predefine it somewhere. If you want to be flexible (even if in the future some other columns will be contained in the response), it may be an option to define a table with the column - datatype definitions. If the table is small, you can completely read it into your BLT and use XPath to extract the datatype of a response column. Extracting values with XPath expressions is really fast.

If there are only a few columns, you may also predefine a BLT XML property with the column - datatype definitions and use this with XPath to assign the datatype to the response columns.

What do you think?

Michael