Adding Type and Fault in 'wsdl' diagram

General discussions about code engineering

Moderator: Moderators

Adding Type and Fault in 'wsdl' diagram

Postby bartosz.wisniowski@pl.ey.com » Wed Sep 09, 2015 10:34 am

Hello,
I tried to made a .WSDL document by modelling WSDL diagram in MagicDraw. With use of 'code engineering set' I can achieve following code:

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

<definitions name="Def_Name" targetNamespace="http://XXXX" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://XXXX" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<message name="test1">
<part name="test1" type="test1"/>
</message>
<message name="test2">
<part name="test2" type="test2"/>
</message>
<portType name="pName">
<operation name="operation">
<input message="tns:test2"/>
<output message="tns:test1"/>
</operation>
</portType>
<binding name="pName" type="tns:pName">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="operation">
<soap:operation soapAction="operation"/>
<input>
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:XXXX"/>
</input>
<output>
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:XXXX"/>
</output>

</operation>
</binding>
<service name="Def_Name">
<port binding="tns:pName" name="pName"/>
</service>
</definitions>

Unfortunately it is not a fully valid .wsdl file. My question is what (and how) should I do on the WSDL block diagram in MagicDraw to achive section <types> </types> , and how to add 'fault 'comunicate?
Thanks for all help
bartosz.wisniowski@pl.ey.com
Forum Newbie
Forum Newbie
 
Posts: 19
Posts Rating:0
Joined: Thu Sep 03, 2015 4:28 am

Re: Adding Type and Fault in 'wsdl' diagram

Postby gedkvi » Wed Sep 16, 2015 11:36 am

Hello,
for types, create a WSDLTypes element and place it under your WSDLDefinitions element in the containment tree. Then go to the specification of WSDLTypes element - > Tags - > extension and create a value. You can write your own xml schema in there. After generating a wsdl file the <type> tags should appear with the information.

For the second part of the question: when you create a WSDLOperation in a WSDLBinding, create a parameter for it(goto the specifications of the operation, choose parameters and click Create). Then apply a WSDLFault stereotype for it. Parameters can have either WSDLFault, WSDLRequest or WSDLResponse stereotypes applied.

Edit: as for this error “Error: (24, 25) cvc-complex-type.2.4.b: The content of element 'operation' is not complete. One of '{"http://schemas.xmlsoap.org/wsdl/":documentation, WC[##other:"http://schemas.xmlsoap.org/wsdl/"], "http://schemas.xmlsoap.org/wsdl/":input, "http://schemas.xmlsoap.org/wsdl/":output}' is expected. “ make sure that operations have WSDLOperation stereotype applied and the parameters in the operation have either WSDLFault, WSDLRequest or WSDLResponse stereotypes applied. There are no limitations for operation count per porttype.

Hope this helps
gedkvi
Customer Support
Customer Support
 
Posts: 55
Posts Rating:7
Joined: Wed Sep 16, 2015 11:25 am

Re: Adding Type and Fault in 'wsdl' diagram

Postby bartosz.wisniowski@pl.ey.com » Thu Sep 17, 2015 5:33 am

Thank you very much for help. The answers were accurate, however since I added this post I move a little and I have different types of problems.
For this time I am trying to overcome two obstacles:

1. How to link existing 'xsd' file with the WSDLMessage?
I defined WSDLMessage with the name TEST1. Next I added the attribute with the name 'test1' and now I know that I should use the extension option and in some way link a type of attribute with some XSD
file. I tried a few ways but I dont know what things should be definied to do it right ( what in attribute and what in types section?)
Do you know how to do in proper way?

2. I am adding a new operation to binding or porttypeand than defined the parameter i.e. parameter name -' test1' , stereotype - WSDLresponse , direction - out, and as a type i set a created WSDLMessage 'TEST1' . Unfortunately every time when I try to it this way I get an information:
'Error: (39, 35) cvc-complex-type.2.4.a: Invalid content was found starting with element 'input'. One of '{"http://schemas.xmlsoap.org/wsdl/":fault}' is expected.'
Could you tell me what is wrong with my way of thinking?

I know that these question may seems trivial, but I am a newbe in (MD, WSDL and XML area) :)
Thank you very much for all help.
bartosz.wisniowski@pl.ey.com
Forum Newbie
Forum Newbie
 
Posts: 19
Posts Rating:0
Joined: Thu Sep 03, 2015 4:28 am

Re: Adding Type and Fault in 'wsdl' diagram

Postby gedkvi » Thu Sep 17, 2015 10:00 am

Hi,

1. XSD code engineering capabilities are available with Cameo Data Modeling plugin. It's trail version is available from MagicDraw > Help > Resource / Plugins Manager > Plugins (commercial) > Cameo Data Modeler. With this plugin you can reverse engineer an XSD file and have all of the namespaces/types etc. as model elements. Then you can refer them as types.
I assume you already have some .xsd file and do not need to model it. You should create a new engineering set 'XML Schema'. Then as with all engineering sets, click Edit, select the .xsd file. Right click the engineering set you created and select Reverse. You will get a model that contains all the data in the .xsd file. You can then refer to some XSDcomplexTypes or XSDsimpleTypes in your WSDLPart. You do not need to set a type for the message itself, you need to set the types for WSDLParts.
When you import the .xsd file you will need to link your WSDLDefinitions component with xmlns relation with the created namespace(s). Add an alias for the xmlns relation (like X, or xs, or whawtever you like). You need to do this because there can only be one main target namespace. After this you can go to the specifications of WSDLPart (the property in message) and choose a type(it should be the one you reverse engineered and the type should be either something like XSDcompllexType of XSDsimpleType).

2. I tried to reproduce your problem, but had no success. I have added a parameter, a stereotype and a direction, set the type to the message I have created. I've tried to reproduce it by changing message positions between one another, changing the parameter positions but I can't get the error you have.
Can you attach a little sample model of the problem you have ?

Sincerely,
NoMagic Customer Support
gedkvi
Customer Support
Customer Support
 
Posts: 55
Posts Rating:7
Joined: Wed Sep 16, 2015 11:25 am

Re: Adding Type and Fault in 'wsdl' diagram

Postby bartosz.wisniowski@pl.ey.com » Fri Sep 18, 2015 1:29 am

Hello,
Thanks for all help. :)
I have a one more question.Is there any other option to import xsd file, beside using cameo?
i.e. when 'XSD' file and genereted 'WSDL' are located in the same folder, some option to import XSD by using only namespace and name of xsd ( without reverse engineering?).
bartosz.wisniowski@pl.ey.com
Forum Newbie
Forum Newbie
 
Posts: 19
Posts Rating:0
Joined: Thu Sep 03, 2015 4:28 am

Re: Adding Type and Fault in 'wsdl' diagram

Postby gedkvi » Fri Sep 18, 2015 4:29 am

Hi,
I assume that when you say import xsd, you mean that you want MagicDraw to read it and create appropriate model elements in the model. This can only be achieved using reverse engineering of XML Schema(cameo data modeler).
Ofcourse you can create all of the same structure of the xsd file yourself(without using CDM) and have a "mirror" of the xsd file in the model that is in no way dependant to the xsd file itself. MagicDraw has XML_Schema_Profile.mdzip that is automatically loaded when you create a wsdl diagram. This profile contains all of the stereotypes for XML schema, this allows you to create a schema with simple, complex etc. types of elements.

Sincerely,
NoMagic Customer Support
gedkvi
Customer Support
Customer Support
 
Posts: 55
Posts Rating:7
Joined: Wed Sep 16, 2015 11:25 am

Re: Adding Type and Fault in 'wsdl' diagram

Postby bartosz.wisniowski@pl.ey.com » Fri Sep 18, 2015 12:30 pm

Hello,
I am finally know how to describe my problem. As I said I am trying to link an existing on the computer in some folder XSD file as a element of WSDLMessage. On a page 297 in 'MD CodeEngineering UserGuide' I found some info about messages and types in WSDLdiagram in MD. ( I enclosed a picture for better description).

I defined a type section as:
<types>
<xs:schema targetNamespace="http://xxxxx" elementFormDefault="qualified">
<xs:import namespace="http://xxxxx/xsd" schemaLocation="xsd/xxxx.xsd"/>
</xs:schema>
<types>

but i dont know how to put element into WSDL message to achieve something like that:

<message name="XMessage">
<part name="XMessage" element="Xelement"/>

or something like on enclosed picture.

Thanks for your patience and time.
You do not have the required permissions to view the files attached to this post.
bartosz.wisniowski@pl.ey.com
Forum Newbie
Forum Newbie
 
Posts: 19
Posts Rating:0
Joined: Thu Sep 03, 2015 4:28 am

Re: Adding Type and Fault in 'wsdl' diagram

Postby gedkvi » Mon Sep 21, 2015 7:06 am

Hi,
I made a little example and attached it. You can probably get rid of the <types> block and the nasty import with multiple namespaces at all.

The result from the attached project is this:
Code: Select all
<?xml version='1.0' encoding='windows-1257'?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://xxxxx">
   <message name="msg">
      <part element="xs:myType" name="part1"/>
   </message>
</definitions>


Note that what i did was create a simple class in the namespace. I have set it as a type for part1 and added a tag value "element".

Hope this will help,
NoMagic Customer Support
You do not have the required permissions to view the files attached to this post.
gedkvi
Customer Support
Customer Support
 
Posts: 55
Posts Rating:7
Joined: Wed Sep 16, 2015 11:25 am

Re: Adding Type and Fault in 'wsdl' diagram

Postby bartosz.wisniowski@pl.ey.com » Wed Sep 23, 2015 6:52 am

Ok,
So If I have group of .xsd files I need to set as a targetnamespace a path to the folder where they are stored? And than as a type of each message put a name of proper .xsd file?
Is it enough to put a namespace block (named same as a path to the catalogue on my PC) or Do I need to put a section types with some extesion ( if yes, what this extesion should contain?)

I want to achieve WSDL file in 'document/literal – Wrapped pattern style '

Thanks for all help
bartosz.wisniowski@pl.ey.com
Forum Newbie
Forum Newbie
 
Posts: 19
Posts Rating:0
Joined: Thu Sep 03, 2015 4:28 am

Re: Adding Type and Fault in 'wsdl' diagram

Postby gedkvi » Thu Sep 24, 2015 2:35 am

Hello,
Messages themselves do not need a type. Message parts (properties) do.
If you want the types section generated, you need to put it.
Here is another example. It has a location for and xsd file, it has the types section and it has the types set for message parts.
The result is this:
Code: Select all
<?xml version='1.0' encoding='windows-1257'?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.example.org">
   <types>   
      <xsd:schema>     
         <xsd:import id="xsdFile.xsd" namespace="http://www.example.org" schemaLocation="xsdFile.xsd"/>
                </xsd:schema>
   </types>
   <message name="message">
      <part element="xsd:someComplexType1" name="unnamed1"/>
      <part element="xsd:someComplexType2" name="unnamed2"/>
   </message>
</definitions>


I hope it will help,
NoMagic Customer Support
You do not have the required permissions to view the files attached to this post.
gedkvi
Customer Support
Customer Support
 
Posts: 55
Posts Rating:7
Joined: Wed Sep 16, 2015 11:25 am

Next

Return to Code engineering

Who is online

Users browsing this forum: No registered users and 0 guests