Error 13141 when reading xml schema

Posted by Admin on 05-Mar-2008 09:45

Hi,

I'm struggling under the burden of heavy xml schemas and OpenEdge doesn't really support me. When I try to create a dataset from a schema I get

error 13141 "Invalid 'maxOccurs' attribute value set for BLOB or CLOB field 'flightIndicator'. (13141)"

This is what that part of the schema looks like:

<xs:element name="flightIndicator" minOccurs="0" maxOccurs="9">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:annotation>

<xs:documentation xml:lang="en">

Edifact representation: an..6

</xs:documentation>

</xs:annotation>

<xs:minLength value="1"/>

<xs:maxLength value="6"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

When I try to create a mapping for flightIndicator (which I actually don't really think should be a BLOB/CLOB) I get a message saying:

Field names in field-type-mapping argument must be qualified with table name. (13202)

According to documentation I should use the buffer name when using ProDataSets. How do I know the buffer-name since I havent created the dataset yet. This is what I do:

hFlightInfoRequest:READ-XMLSCHEMA( "FILE"

, "/tmp/Air_FlightInfo_05_1_1A.xsd"

, TRUE

, "flightIndicator, CLOB"

, "STRICT").

I'm using OE10.1B.

Does anyone have a clue why this happens?

Edit: More info...

All Replies

Posted by Robin Brown on 05-Mar-2008 11:58

Hi Jens,

The flightIndicator definition is being mapped to a CLOB because you are specifying "TRUE" for the third argument (override-default-mapping) to READ-XMLSCHEMA. The maxOccurs="9' in the .xsd indicates an array field of extent 9, and CLOB fields cannot be array fields. Specifying FALSE, or ? for the override-default-mapping argument will map the flightIndicator field to a CHARACHTER, which can be an array field.

Regards,

Robin Brown (OpenEdge Development)

Posted by Admin on 06-Mar-2008 01:13

Thanks!

That takes away that error but produces a more generic one:

XML Schema does not map to a dataset definition. (13106)

Defining the last parameter as STRICT or LOOSE makes no difference.

I've attatched the schema and this is my code:

&#9472;

DEFINE VARIABLE hFlightInfoRequest AS HANDLE NO-UNDO.

CREATE DATASET hFlightInfoRequest.

hFlightInfoRequest:READ-XMLSCHEMA( "FILE"

, "/tmp/Air_FlightInfo_05_1_1A.xsd"

, FALSE

, ?

, "STRICT").

IF VALID-HANDLE( hFlightInfoRequest) THEN

DELETE OBJECT hFlightInfoRequest.

ASSIGN

hFlightInfoRequest = ?.

Suggestions anyone?

Posted by Robin Brown on 06-Mar-2008 13:35

Hi Jens,

The .xsd file you attached does not fit the general format for a DataSet XML Schema definition, which is a sequence of temp-table definitions, each temp-table definition being a sequence of field definitions.

While DataSet definitions map well to XML Schema, it is not true that all possible XML Schemas can be converted into a DataSet definition.

The first element in the "Air_FlightInfo" sequence is "generalFlightInfo", which does not map to a temp-table, it has no field definitions. The "generalFlightInfo" definition, however, is a sequence of temp-table definitions. I don't know if you have control over the XML Schema, but removing the "generalFlightInfo" element definition, making the "Air_FlightInfo" a sequence beginning with the "flightDate" temp-table definition will allow READ-XML Schema to create a DataSet named Air_FlightInfo with 7 member temp-tables. I'm attaching a modified .xsd file.

Regards,

Robin

Posted by Admin on 07-Mar-2008 01:21

The thing is this is the xsd I have to use. This is a request sent to a webservice that expects the xml to be formed this way. They expect the input to follow this schema. This is actually one of the simpler .xsd's I have to implement. The reply .xsd file is 90k (this one is 13k).

I've tried to look into the knowledge base and the psdn but I cannot find any good examples of how to implement a webservice where the inputs and outputs are not only simple xml's. Some real life examples would be nice.

Also: using the command line utility bprowsdldoc.bat doesn't produce very much of help. This particular operation is documented as :

PROCEDURE Air_FlightInfo:

DEFINE INPUT PARAMETER generalFlightInfo AS LONGCHAR NO-UNDO.

DEFINE OUTPUT PARAMETER messageActionDetails AS LONGCHAR NO-UNDO.

DEFINE OUTPUT PARAMETER interactiveFreeText AS LONGCHAR NO-UNDO.

DEFINE OUTPUT PARAMETER responseError AS LONGCHAR NO-UNDO.

DEFINE OUTPUT PARAMETER flightScheduleDetails AS LONGCHAR NO-UNDO.

END PROCEDURE.

So basically just XML's going in and out.

Posted by Thomas Mercer-Hursh on 07-Mar-2008 11:21

The simple lesson here is that while the WRITE-XML and READ-XML methods seem very attractive, they really aren't general purpose, universal tools. They work fine to and from ABL, i.e., TT->XML->TT or PDS->XML->PDS, but it is very chancy whether they will work to or from outside structures which one cannot control. If one can control the outside structure, then it is possible to make it look like what would be produced by a WRITE-XML method, but if one can't, then it is back to SAX and DOM to do it by hand. That might be disappointing, but it does seem to be the current state of the art. Fortunately, SAX is pretty straightforward and quite fast, as well as being very flexible.

Posted by Robin Brown on 07-Mar-2008 12:28

Given the new information that you are trying to call a Web service, and assuming that the .xsd you attached represents a Web service operation, I would expect the generalFlightInfo parameter would be mapped to a DATASET parameter and not a LONGCHAR. Are you using -show100style on the bprowsdldoc command? Can you attach the WSDL file you are using?

Thanks,

Robin

Posted by Admin on 10-Mar-2008 02:33

Thanks for you answer. Using the -show100style does indeed change the layout of the procedure.

PROCEDURE Air_FlightInfo:

DEFINE INPUT PARAMETER Air_FlightInfo_5_1 AS LONGCHAR NO-UNDO.

DEFINE OUTPUT PARAMETER Air_FlightInfoReply_5_1 AS LONGCHAR NO-UNDO.

END PROCEDURE.

It's still not datasets. Those two parameters are specified in external .xsd's.

This looks a bit better but it still doesn't look perfect! I've attatched the .wsdl and the two corresponding .xsd's.

Edit:

I've got no problem working with the xml's in a more "hands on way". I only want all possible help openedge can provide. The thing that is really boring to do is to create all .xmls. I got about 30 or so xml-documents to create. And doing it the "CREATE X-DOCUMENT ..." way is quite time consuming.

null

Posted by Robin Brown on 10-Mar-2008 14:41

Using -show100style might actually make your programming harder in this case, as you'd need to create the XML for the entire request message, then parse the response on output. Sorry I mislead you, I should have noticed from the original PROCEDURE signature that you were not using -show100style.

Given what you attached, only 2 of the 5 parameters in the original signature can be mapped to a DATASET definition: generalFlightInfo and messageActionDetails.

I tested this by extracting each parameter's XML Schema definition into a separate .xsd file and running bproxsdto4gl to generate a DATASET definition in a .i file.

If you get a chance, please log an issue with Tech support about the fact that bprowsdldoc doesn't generate DATASET parameters for these two.

Regards,

Robin

This thread is closed