Adding a new operation to existing webservice - eclipse

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>

Related

What is the WSDL-equivalent of openapi oneOf?

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?

SOAP Payload with nested complexType

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>

Group name attribute invalid

I am trying to create a Group.
Based on your documentation, I can create a "name" associated with that group in the source editor but I can't through the GUI. If I try and create one manually in the source it says that "name is not a valid attribute for group".
What am I doing wrong? I would like to add this for grouping like items.
<xs:schema elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="myElm">
<xs:complexType>
<xs:sequence>
<xs:group name="myGroup" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Only the root element can have a name. When you reference it for inclusion, the name attribute is not valid.
Adding a name attribute in where is is referenced (i.e. ) will result in the error "name is not a valid attribute for group".
This conforms to the W3C XSD Standard. Using the UI it is not possible to perform this action, as name is not available, however you can do this by changing the source code.
<?xml version="1.0" encoding="utf-8" ?>
<!--Created with Liquid XML Studio - 30 Day Trial Edition 7.0.0.604 (http://www.liquid-technologies.com)-->
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:group name="myGroup" />
<xs:element name="myElm">
<xs:complexType>
<xs:sequence>
<xs:group ref="myGroup" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
You can then add a particle (sequence/choice/all) to the group definition anb build up groups of elements that can be re-used as a block.

Stream binary part of a message from BizTalk orchestration

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

Referencing ComplexType Elements within ComplexType/Sequence Elements in XSD

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>