Currently I need to find out what oneOf from openapi (oneOf - openapi) could look like in WSDL.
The definiton of oneOf is:
oneOf – validates the value against exactly one of the subschemas
In case of oneOf the documentation says that an (JSON)-object should be valid against only one of the specified schemas. If the object is valid against multiple schemas, it wouldn't be valid/correct.
Unfortunately I am not a WSDL-expert, so I am not sure how you could represent something like oneOf in WSDL. I thought I could do something like this:
Openapi-Example
schemas:
fruit:
title: fruit
properties:
color:
type: string
oneOf:
- $ref: '#/components/schemas/apple' <- schema with property 'kind'
- $ref: '#/components/schemas/banana' <- schema with property 'count'
WSDL-equivalent
<xs:complexType name="Fruit">
<xs:sequence>
<xs:element minOccurs="0" name="color" type="xs:string" />
<xs:element minOccurs="0" name="apple" type="schemas:apple" />
<xs:element minOccurs="0" name="banana" type="schemas:banana" />
</xs:sequence>
</xs:complexType>
Or maybe this one
<xs:complexType name="Fruit">
<xs:sequence>
<xs:element minOccurs="0" name="color" type="xs:string" />
<xs:element minOccurs="0" name="kind" type="xs:string" />
<xs:element minOccurs="0" name="count" type="xs:double" />
</xs:sequence>
</xs:complexType>
Maybe it is a workaround, but even both WSDL constructs are not really restricting one of the schemas; as mentioned the object should be only valid against one of the specified schemas.
Does anyone know how you could represent oneOf in WSDL?
Related
I'm trying to make a SOAP request where a parameter is a complex type, and I'm having trouble getting the syntax right.
WSDL: https://www.dayforcehcm.com/DataSvc/DayforceService.svc?singleWsdl
Action: IDayforceService/Query
Here is the SOAP request that was generated by SoapUI:
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://Dayforce/Services/DayforceService">
<SOAP-ENV:Body>
<ns1:Query>
<ns1:sessionTicket>?</ns1:sessionTicket>
<ns1:request/>
</ns1:Query>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
My question is how to fill in the <ns1:request/> element. The request should be a GetReportDefinitionsRequest, and it needs to provide a string value for XRefCode.
SoapUI isn't being much help here, and WSDL to class generators I've tried have similar problems. At this point I'd settle for just knowing the proper XML syntax
Here are the relevant types (also available in the WSDL above).
Query:
<xs:element name="Query">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="sessionTicket" nillable="true" type="xs:string"/>
<xs:element xmlns:q9="http://Dayforce/Services/Data" minOccurs="0" name="request" nillable="true" type="q9:DFRequest"/>
</xs:sequence>
</xs:complexType>
</xs:element>
GetReportDefinitionsRequest:
<xs:complexType name="GetReportDefinitionsRequest">
<xs:complexContent mixed="false">
<xs:extension base="tns:DFRequest">
<xs:sequence>
<xs:element minOccurs="0" name="XRefCode" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="GetReportDefinitionsRequest" nillable="true" type="tns:GetReportDefinitionsRequest"/>
DFRequest:
<xs:complexType name="DFRequest">
<xs:complexContent mixed="false">
<xs:extension base="tns:DFObject">
<xs:sequence/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="DFRequest" nillable="true" type="tns:DFRequest"/>
DFObject:
<xs:complexType name="DFObject">
<xs:sequence/>
</xs:complexType>
<xs:element name="DFObject" nillable="true" type="tns:DFObject"/>
I was able to get the sample code running and hook in to get the XML generated for the request. Here's the result, in case it helps anyone in the future.
The important part is to assign the type attribute to the tag. That involves importing the http://www.w3.org/2001/XMLSchema-instance namespace to get the type attribute, and the http://Dayforce/Services/Data namespace for the type itself.
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:dfs="http://Dayforce/Services/DayforceService">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<dfs:Query>
<dfs:sessionTicket>?</dfs:sessionTicket>
<dfs:request
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dfd="http://Dayforce/Services/Data"
i:type="dfd:GetReportDefinitionsRequest">
<dfd:XRefCode>?</dfd:XRefCode>
</dfs:request>
</dfs:Query>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I have an XML file that describes a header and a list. I need to generate a CSV file where the first line of the file is constructed from the header information and the subsequent lines of the file constructed from the list. The header has a different number of columns to the list items.
This is easy to do with xsl. How can I do it with the data mapper using the .NET mapping engine?
A simple example to explain. XSD of input xml
<xs:element name="Root">
<xs:complexType>
<xs:sequence>
<xs:element name="A" />
<xs:element name="B" />
<xs:element name="Line" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="C" />
<xs:element name="D" />
<xs:element name="E" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
An Example Input XML
<Root>
<A>Header Value</A>
<B>112233</B>
<Line>
<C>22</C>
<D>Fred</D>
<E>1</E>
</Line>
<Line>
<C>34</C>
<D>Jim</D>
<E>2</E>
</Line>
<Line>
<C>42</C>
<D>Amanda</D>
<E>1</E>
</Line>
<Line>
<C>1267</C>
<D>Vickie</D>
<E>2</E>
</Line>
</Root>
Required Text Output:
Header Value|112233
22|Fred|1
34|Jim|2
42|Amanda|1
1267|Vickie|2
Generating either
Header Value|112233
or
22|Fred|1
34|Jim|2
42|Amanda|1
1267|Vickie|2
as individual csv files is easy (as it should be) but how can I can't see how to produce the required file other than resorting back to xslt.
You can set up a transform that looks something like this if you want to be able to dynamically set the headers.
You double up the 'Row' inputs using the 'Duplicate' option
Before you do that you need to tweak your schema. The input values A-E need typing (note the type="xs:string").
<?xml version="1.0" encoding="utf-8" ?>
<!--Created with Liquid Studio 2019 (https://www.liquid-technologies.com)-->
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Root">
<xs:complexType>
<xs:sequence>
<xs:element name="A" type="xs:string" />
<xs:element name="B" type="xs:string" />
<xs:element name="Line" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="C" type="xs:string" />
<xs:element name="D" type="xs:string" />
<xs:element name="E" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
This will give you output data that looks like this (note it always outputs 3 columns, so you get a trailing '|').
Header Value|112233|
22|Fred|1
34|Jim|2
42|Amanda|1
1267|Vickie|2
If you just want the data and no header then you can just connect it up like this
Can anyone suggest a good tutorial on how to add new operations to already existing webservices?I referred many tutorials but most are discussing about creating a new wsdl and then changing it.I also referred the following and when i tried it, the design view is not showing the names of existing ports.PLZ help by giving me suitable advice.
http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.wst.wsdl.ui.doc.user%2Ftasks%2Ftcrtwsdl.html
If the web service already exists you can edit the existing interface and code behind to add the new operations.
Once you have done this you should be able to use a tool to generate a new WSDL which can be deployed along with your updated service.
The following tool; Java2WSDL should help, http://axis.apache.org/axis/java/user-guide.html#Java2WSDL:_Building_WSDL_from_Java
Hope this helps.
Add an element in XSD file and map local part to new method in endpoint controller. getCountryRequest is existing operation in below XSD and I have added getCountryByCurrencyRequest.
<xs:element name="getCountryRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="getCountryResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="country" type="tns:country" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="getCountryByCurrencyRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
I must send a MTOM request to a WCF service that expects the following schema as input:
<xs:complexType name="BinaryRequest">
<xs:sequence>
<xs:element minOccurs="0" name="requestContent" nillable="true" type="BinaryRequestContent" />
</xs:sequence>
</xs:complexType>
<xs:element name="BinaryRequest" nillable="true" type="BinaryRequest" />
<xs:complexType name="BinaryRequestContent">
<xs:sequence>
<xs:element minOccurs="0" name="partData" nillable="true" type="xs:base64Binary" />
<xs:element minOccurs="0" name="partNumber" type="xs:int" />
<xs:element minOccurs="0" name="transactionId" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="BinaryRequestContent" nillable="true" type="BinaryRequestContent" />
As you can see the "partData" property is of type byte[] and I would like to have the posibility to stream it and send it in a separated MIME part.
Using the example from http://seroter.wordpress.com/biztalk-and-wcf-part-iv-attachment-patterns/ is not possible because my binary data is only a part of the response.
Any idea how to do this?
I have a test solution but the binary content is send inline as base64 not separated as an attachment
https://docs.google.com/file/d/0B1M277-_UZ35Si1JWWw5Nm9ia0E/edit?usp=sharing
I am trying to construct a xsd file (inside a WSDL) to get data from a SOAP Request. I have the expected soap Request:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<m:upsertEntity xmlns:m="http://www.boomi.com/connector/wss">
<eTimeRequest>
<ObjectType>String</ObjectType>
<Action>String</Action>
<eTimeID>String</eTimeID>
<OperativeID>String</OperativeID>
</eTimeRequest>
</m:upsertEntity>
</SOAP-ENV:Body>
Here is what I have tried. You can not have a <xs:ComplexType> within another one. I have tried the referencing approach, but apparently, when I tried to do a SOAP Request with it, it was invalid. What can I do?
Here is the XSD within the WSDL:
<xs:schema elementFormDefault="qualified" targetNamespace="http://www.boomi.com/connector/wss">
<xs:element name="eTimeRequest" type="eTimeRequest"/>
<xs:complexType name="eTimeRequest">
<xs:sequence>
<xs:element maxOccurs="1" minOccurs="0" name="ObjectType" type="xs:string"/>
<xs:element maxOccurs="1" minOccurs="0" name="Action" type="xs:string"/>
<xs:element maxOccurs="1" minOccurs="0" name="eTimeID" type="xs:string"/>
<xs:element maxOccurs="1" minOccurs="0" name="OperativeID" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="upsertEntity" type="tns:upsertEntity"/>
<xs:complexType name="upsertEntity">
<xs:sequence>
<xs:element minOccurs="0" type="eTimeRequest"/> <!-- These should be the ObjectType, Action, eTimeID and OperativeID in here -->
</xs:sequence>
</xs:complexType>
</xs:schema>
EDIT
Another thing I noticed in the code I linked was that I used the Type="eTimeRequest" and not ref="eTimeRequest". No matter though, still invalid. Here is the error message I get on validation:
Invalid XML schema: ''eTimeRequest' must refer to an existing element.'
Sorry for those who have read this. I obviously made a mistake in my XSD code, and wasted time doing so.
It's true, <xs:ComplexType> is NOT ALLOWED in <xs:ComplexType>, but <xs:Element> containing <xs:ComplexType> is allowed in <xs:ComplexType>. The original SOAP Request generated was therefore invalid. I ran the new version through our system and it worked.
The Correct XSD Schema in the WSDL should have read:
<xs:schema elementFormDefault="qualified" targetNamespace="http://www.boomi.com/connector/wss">
<xs:element name="upsertEntity" type="tns:upsertEntity"/>
<xs:complexType name="upsertEntity">
<xs:sequence>
<xs:element name="eTimeRequest">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="1" minOccurs="0" name="ObjectType" type="xs:string"/>
<xs:element maxOccurs="1" minOccurs="0" name="Action" type="xs:string"/>
<xs:element maxOccurs="1" minOccurs="0" name="eTimeID" type="xs:string"/>
<xs:element maxOccurs="1" minOccurs="0" name="OperativeID" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>