I do not know how to write xsd for this request down.
Method POST
Request Parameters
all required
Tag Name
publicId type String
publicIdType type String
actorType type String
startDate type Date
endDate type Date
example
<actor>
<actorPublicId>2424252</actorPublicId>
<actorPublicIdType>1341416</actorPublicIdType>
<actorType>test</actorType>
<startDate>2014-03-10T22:34:34.999+2:00</startDate>
<endDate>2014-03-10T22:34:34.999+2:00</endDate>
</actor>
Your XSD is ..
<xs:schema
attributeFormDefault="unqualified"
elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="yourNamespace"
xmlns:pref="yourNamespace">
<xs:element name="actor" type="pref:actor"/>
<xs:complexType name="actor">
<xs:sequence>
<xs:element type="xs:string" name="actorPublicId"/>
<xs:element type="xs:string" name="actorPublicIdType"/>
<xs:element type="xs:string" name="actorType"/>
<xs:element type="xs:dateTime" name="startDate"/>
<xs:element type="xs:dateTime" name="endDate"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
Related
Requirement is read data from file and invoke webservice. Target webservice can handle one payload at a time but there will be multiple payload in source.
So am using while loop to process payload one by one.
Issue: In target service EarningTypeInclusion is optional element, so in source some payload this element will be present and in some payload this option element will not be present.
<thresholdRequestInterface xmlns:xs="http://www.sample.com/ns/LMSReferrals">
<thresholdRequest>
<Referral>11</Referral>
<thresholdValue>100</thresholdValue>
<EarningTypeInclusion>
<earningType>positive</earningType>
<ProvisionId>1000</ProvisionId>
</EarningTypeInclusion>
</thresholdRequest>
<thresholdRequest>
<Referral>11</Referral>
<thresholdValue>100</thresholdValue>
</thresholdRequest>
</thresholdRequestInterface>
If am using assign activity, then selection failure fault will come when optional elements are not present in source payload. We are using BPEL 10g, no option in assign activity to supress selection failure fault.
So decided to use transformation inside while loop .
logic used
Read from file
assign Loop counter=1
Count of payload(read from file)
While loop counter<= Count of payload
pass loop counter param value to transform
transform source i.e thresholdRequest[loopcounter] to target
Invoke target web service
increment loop counter
end loop;
Problem is same data is getting trsnformed.
In the below example, referral 11 data is loading 3 times. I have checked conter value, its getting incremented but inside transformation same values are getting transformed.
<thresholdRequestInterface xmlns:xs="http://www.sample.com/ns/LMSReferrals">
<thresholdRequest>
<Referral>11</Referral>
<thresholdValue>100</thresholdValue>
<EarningTypeInclusion>
<earningType>positive</earningType>
<ProvisionId>1000</ProvisionId>
</EarningTypeInclusion>
</thresholdRequest>
<thresholdRequest>
<Referral>12</Referral>
<thresholdValue>100</thresholdValue>
</thresholdRequest>
<thresholdRequest>
<Referral>13</Referral>
<thresholdValue>100</thresholdValue>
<EarningTypeInclusion>
<earningType>positive</earningType>
<ProvisionId>1000</ProvisionId>
</EarningTypeInclusion>
</thresholdRequest>
</thresholdRequestInterface>
Source
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns="http://www.sample.com/ns/LMSReferrals" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://www.sample.com/ns/LMSReferrals" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="thresholdRequestInterface">
<xs:complexType>
<xs:sequence>
<xs:element name="thresholdRequest" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Referral" type="xs:string"/>
<xs:element name="thresholdValue" type="xs:int"/>
<xs:element name="EarningTypeInclusion" minOccurs="0" maxOccurs="1" >
<xs:complexType>
<xs:sequence>
<xs:element name="earningType" type="xs:stirng" />
<xs:element name="ProvisionId">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="20" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Please find the schema structure for source and target
Target
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns="http://www.sample.com/ns/LMSReferrals" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://www.sample.com/ns/LMSReferrals" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="thresholdRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="Referral" type="xs:string"/>
<xs:element name="thresholdValue" type="xs:int"/>
<xs:element name="EarningTypeInclusion" minOccurs="0" maxOccurs="1" >
<xs:complexType>
<xs:sequence>
<xs:element name="earningType" type="xs:stirng" />
<xs:element name="ProvisionId">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="20" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Please note schema validation is enabled at target webservice.
Is there a specific reason that you are using Transform.Try using ora:getElement('/thresholdRequestInterface /thresholdRequest',bpws:getVariable(loopCounter))
I have following example xml message:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<to>...</to>
<from>...</from>
<id>..</id>
<relatesTo>...</relatesTo>
<action>...</action>
<version>...</version>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<customComplexElement>
<a>a_v</a>
<b>b_v</b>
<c>c_v</c>
<d>d_v</d>
<e>e_v</e>
<f>f_v</f>
</customComplexElement>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
From which I have generated a xsd file with use of one of online tools:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified">
<import namespace="http://schemas.xmlsoap.org/soap/envelope/" schemaLocation="http://schemas.xmlsoap.org/soap/envelope/"></import>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="id" type="xs:string"/>
<xs:element name="relatesTo" type="xs:string"/>
<xs:element name="action" type="xs:string"/>
<xs:element name="version" type="xs:string"/>
<xs:element name="customComplexElement">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="a"/>
<xs:element type="xs:string" name="b"/>
<xs:element type="xs:string" name="c"/>
<xs:element type="xs:string" name="d"/>
<xs:element type="xs:string" name="e"/>
<xs:element type="xs:string" name="f"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Then I generate the appropriate header file with wsdl2h.exe and then compile it with soapcpp2.exe compiler.
Then I try to read xml file with a function soap_read_customComplexElement() and all I get is SOAP_TAG_MISMATCH. This method seems to work if I get rid of all the soap stuff the message but I wonder if there are some functions in gSOAP to parse soap envelope, header and body?
I've had same problem. But i've just fixed it.
So, in my case i use this line of code.
struct soap *soap = soap_new1(SOAP_C_UTFSTRING | SOAP_XML_IGNORENS | SOAP_XML_TREE);
The key paramter is SOAP_XML_IGNORENS. This parameter ignore namespaces.
SOAP_XML_IGNORENS in: ignores the use of XML namespaces in input
The root of this problem is that you don't declare namespaces in your body content. That why gSoap don't know how to convert this xml.
This wouldn't be converted, because gSoap don't know what is ns4:
<ns4:ParseKeywords><ns4:Keyword>Hello</ns4:Keyword></ns4:ParseKeywords>
But if i declare namespace it will be converted
<ns4:ParseKeywords xmlns:ns4="com.idurdyev.idcommerce:ParseKeywords:1.0"><ns4:Keyword>Hello</ns4:Keyword></ns4:ParseKeywords>
I am trying to create a soap web service for a server using jax-ws following this xml schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="OfeliaDataEx">
<xs:complexType>
<xs:sequence>
<xs:element ref="Header"/>
<xs:element ref="User"/>
<xs:element ref="Data"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Header">
<xs:complexType>
<xs:sequence>
<xs:element ref="State"/>
<xs:element ref="TypeReq"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="State" type="xs:string"/>
<xs:element name="TypeReq" type="xs:string"/>
<xs:element name="User">
<xs:complexType>
<xs:sequence>
<xs:element ref="JabberID"/>
<xs:element ref="OpenID"/>
<xs:element ref="OauthToken"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="JabberID" type="xs:string"/>
<xs:element name="OpenID" type="xs:anyURI"/>
<xs:element name="OauthToken">
<xs:complexType>
<xs:sequence>
<xs:element ref="AuthToken"/>
<xs:element ref="TokenSecret"/>
<xs:element ref="ExpireDate"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="AuthToken" type="xs:string"/>
<xs:element name="TokenSecret" type="xs:string"/>
<xs:element name="ExpireDate" type="xs:string"/>
<xs:element name="Data">
<xs:complexType mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="POSI"/>
<xs:element ref="TESTE"/>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="POSI">
<xs:complexType>
<xs:all>
<xs:element ref="TimeStamp"/>
<xs:element ref="RefreshInterval"/>
<xs:element ref="Lon"/>
<xs:element ref="Lat"/>
<xs:element ref="Data"/>
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="RefreshInterval" nillable="true" type="xs:integer"/>
<xs:element name="Lon" nillable="true" type="xs:float"/>
<xs:element name="Lat" nillable="true" type="xs:float"/>
<xs:element name="TESTE">
<xs:complexType>
<xs:all>
<xs:element ref="TimeStamp"/>
<xs:element ref="cenas"/>
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="cenas" nillable="true" type="xs:float"/>
<xs:element name="TimeStamp" type="xs:string"/>
</xs:schema>
My first try was follow a POJO model how ever i did not have any success. I couldnt reproduce the <xs:choice minOccurs="0" maxOccurs="unbounded">. So i am here to ask for an idea to create a soap web service that follows this schema.
best regards,
Why don't you use the xjc tool which comes with your JDK and creates the required jax-b artifacts from a xsd...
something like this will create the classes in the 'generated' subfolder of the current directory:
xjc /the/path/to/my/xsdfile.xsd
Also look here: http://docs.oracle.com/javase/6/docs/technotes/tools/share/xjc.html
I am trying to insert primary and foreign keys in XSD schema file below :-
Primary key is StudentID and Foreign Keys are courseID, AddressID, GradeID.
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Student">
<xs:complexType>
<xs:sequence>
<xs:element name="Title" type="xs:string"/>
<xs:element name="FirstName" type="xs:string"/>
<xs:element name="LastName" type="xs:string"/>
<xs:element name="Dateborn" type="xs:date"/>
<xs:element name="Gender" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
However above code is not working in my setup please help me in tracing the issue,
In general you would need to put more details in a question... So this should be enough to understand what else you might need to define, and how. I'll tackle what's needed to understand how to define a primary key/foreign key by illustrating an assumed student/address relationship.
First you need to define a context where these constraints hold true. In my modified XSD, I call it the "World".
<?xml version="1.0" encoding="utf-8" ?>
<!-- XML Schema generated by QTAssistant/XSD Module (http://www.paschidev.com) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="World">
<xs:complexType>
<xs:sequence>
<xs:element ref="Student" maxOccurs="unbounded"/>
<xs:element ref="Address" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:key name="PKStudents">
<xs:selector xpath="Student/StudentID"/>
<xs:field xpath="."/>
</xs:key>
<xs:key name="PKAddresses">
<xs:selector xpath="Address/AddressID"/>
<xs:field xpath="."/>
</xs:key>
<xs:keyref name="FKStudentToAddress" refer="PKAddresses">
<xs:selector xpath="Student/AddressID"/>
<xs:field xpath="."/>
</xs:keyref>
</xs:element>
<xs:element name="Student">
<xs:complexType>
<xs:sequence>
<xs:element name="Title" type="xs:string"/>
<xs:element name="FirstName" type="xs:string"/>
<xs:element name="LastName" type="xs:string"/>
<xs:element name="Dateborn" type="xs:date"/>
<xs:element name="Gender" type="xs:string"/>
<xs:element name="StudentID" type="xs:string"/>
<xs:element name="AddressID" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Address">
<xs:complexType>
<xs:sequence>
<xs:element name="AddressID" type="xs:string"/>
<xs:element name="Street" type="xs:string"/>
<xs:element name="City" type="xs:string"/>
<xs:element name="Province" type="xs:string" minOccurs="0"/>
<xs:element name="Country" type="xs:date" minOccurs="0"/>
<xs:element name="PostalCode" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Then an XML like this would pass or fail, depending on what you do with the values in the StudentID and AddressID fields.
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!-- Sample XML generated by QTAssistant (http://www.paschidev.com) -->
<World xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Student>
<Title>Title1</Title>
<FirstName>FirstName1</FirstName>
<LastName>LastName1</LastName>
<Dateborn>1900-01-01</Dateborn>
<Gender>Gender1</Gender>
<StudentID>StudentID1</StudentID>
<AddressID>AddressID1</AddressID>
</Student>
<Student>
<Title>Title1</Title>
<FirstName>FirstName1</FirstName>
<LastName>LastName1</LastName>
<Dateborn>1900-01-01</Dateborn>
<Gender>Gender1</Gender>
<StudentID>StudentID2</StudentID>
<AddressID>AddressID1</AddressID>
</Student>
<Address>
<AddressID>AddressID1</AddressID>
<Street>Street1</Street>
<City>City1</City>
<Province>Province1</Province>
<Country>1900-01-01</Country>
<PostalCode>PostalCode1</PostalCode>
</Address>
<Address>
<AddressID>AddressID2</AddressID>
<Street>Street1</Street>
<City>City1</City>
<Province>Province1</Province>
<Country>1900-01-01</Country>
<PostalCode>PostalCode1</PostalCode>
</Address>
</World>
To finish your solution, you would need to define the Course and Grade "entities" in your "world", define the xs:key for each, similar to Student/*Address*, then add CourseID and GradeID attributes to the entities that need them, and finally, define the keyref, as above, for Entity to Grade and Entity to Course.
I am using AXIS2 framework for my webservices creating. Now I am secured my webservices using ramprt. Now entire requests and response will be signed and encrypted.
Now my doubt is how can i test it in SOAP UI. when I am loading wsdl file it giving me as
below.
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soapenvelope"
xmlns:sam="http://sample03.policy.samples.rampart.apache.org">
<soap:Header/>
<soap:Body>
<sam:echo>
<!--Optional:-->
<sam:args0>?</sam:args0>
</sam:echo>
</soap:Body>
</soap:Envelope>
Now Ho w can i place digital certificate related data and how can i encrypt the content i want to send to axis server.
Thanks,
Narendra
the certificate data is stored in two xml Files the Outflowsecurity.xml and Inflowsecurity.xml they should look like this:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="action">
<xs:annotation>
<xs:documentation>Outflow security 'action' configuration</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="items" type="xs:string"/>
<xs:element name="user" type="xs:string"/>
<xs:element name="passwordCallbackClass" type="xs:string" minOccurs="0"/>
<xs:element name="signaturePropFile" type="xs:string" minOccurs="0"/>
<xs:element name="encryptionPropFile" type="xs:string" minOccurs="0"/>
<xs:element name="encryptionPropFile" type="xs:string" minOccurs="0"/>
<xs:element name="signatureKeyIdentifier" type="xs:string" minOccurs="0"/>
<xs:element name="encryptionKeyIdentifier" type="xs:string" minOccurs="0"/>
<xs:element name="encryptionUser" type="xs:string" minOccurs="0"/>
<xs:element name="signatureParts" type="xs:string" minOccurs="0"/>
<xs:element name="encryptionParts" type="xs:string" minOccurs="0"/>
<xs:element name="optimizeParts" type="xs:string" minOccurs="0"/>
<xs:element name="encryptionSymAlgorithm" type="xs:string" minOccurs="0"/>
<xs:element name="EmbeddedKeyCallbackClass" type="xs:string" minOccurs="0"/>
<xs:element name="encryptionKeyTransportAlgorithm" type="xs:string" minOccurs="0"/>
<xs:element name="EmbeddedKeyName" type="xs:string" minOccurs="0"/>
<xs:element name="timeToLive" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
for more details go to the Apache help Page
To use the authentification in the Request you need to add a Tag to the soap:Header
<soapenv:Header>
<wsse:Security
soapenv:mustUnderstand="1">
<wsu:Timestamp
wsu:Id="Timestamp-31497899">
<wsu:Created>2008-02-06T13:39:50.943Z</wsu:Created>
<wsu:Expires>2008-02-06T13:44:50.943Z</wsu:Expires>
</wsu:Timestamp>
<wsse:UsernameToken
wsu:Id="UsernameToken-10697954">
<wsse:Username>apache</wsse:Username>
<wsse:Password
Type="http://...#PasswordText">password</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
the namespaces are:
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"