WCF Contract from XML Soap file - wcf

I have an inverse task about of WCF service construction.
Have a SOAP Request description XML file:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<nsp:run xmlns:nsp="http://someurl" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://someurl/NewXMLSchema.xsd ">
<nsp:routes>
<nsp:process>number</nsp:process>
</nsp:routes>
<nsp:params>
<nsp:param name="name_1">?</nsp:param>
<nsp:param name="nam2_2">?</nsp:param>
</nsp:params>
<nsp:files>
<nsp:file name="file_1">b64Binary</nsp:file>
<nsp:file name="file_2">b64Binary</nsp:file>
</nsp:files>
</nsp:run>
</soapenv:Body>
</soapenv:Envelope>
need to design WCF contract which request has a similar description.
How can i do this?

You can't, really.
The SOAP XML file is just the data being sent to the service as a request or from the service as a response.
But that doesn't tell you how your service methods (your contract) should look like.....
The SOAP messages alone are not enough to define the service. You might be able to define the data structures (the data contract) for your WCF service, but not your service contract.
And you won't be able to even define your data contract with this SOAP XML file - since the relevant description of the data types and their structures appears to be hiding in the http://someurl/NewXMLSchema.xsd XML schema file .... unless you have that at hand, you're left with the names of the parameters, at best....

Related

How to get ID's of the records in Cross-reference field using Web API in RSA Archer?

I need to get the ID's of the records in a cross-reference field using Web API. Is there an API method to solve this type of task? Or at least I want to know, how to get the value of a specific field?
There are many different methods described in the documentation for operating with list fields (such as GetValuesListValue) and I wonder if there a same way to solve my task.
I can use ExecuteSeach method, but it isn't very convenient.
Alexander, you can either use the REST or Webservices APIs.
REST APIs
Using the Get content by id, /api/core/content/*contentid*
Then you can pass OData to just get the field (id) contents by passing the following in the body
{"Value":"?$filter=FieldId eq '*field id of cross-reference field*'"}
Webservices APIs
You can call the /ws/record.asmx GetRecordById passing the following
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetRecordById xmlns="http://archer-tech.com/webservices/">
<sessionToken>session token</sessionToken>
<moduleId>int</moduleId>
<contentId>int</contentId>
</GetRecordById>
</soap:Body>
</soap:Envelope>
Then you'd have to iterate through the returned XML to get the field contents.

How to get URL pointing to specific candidate in Workday from WID

I've been try to figure out a way to get a URL pointing to a candidate's profile in Workday given a candidate's WID. My scenario is that I use the Put_Candidate operation (Workday Web Services SOAP API) to create a candidate which lets me know the WID and the Candidate_ID of the created candidate. From this returned information, I was hoping to construct the URL to the created candidate's profile in Workday. Is this possible? I'd appreciate any help/guidance that anyone can provide regarding this sort of scenario. Thank you.
I know its a little late, but if you are still looking for an answer then you can use
Get_workers api in Humar Resource Module and frame a request as below:-
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bsvc="urn:com.workday/bsvc">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken>
<wsse:Username>your username</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">your password</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<wd:Get_Workers_Request xmlns:wd="urn:com.workday/bsvc" version="set appropriate version here">
<wd:Request_References bsvc:Skip_Non_Existing_Instances="false">
<wd:Worker_Reference >
<wd:ID wd:type="WID">Populate WID here</wd:ID>
</wd:Worker_Reference>
</wd:Request_References>
</wd:Get_Workers_Request>
</soapenv:Body>
</soapenv:Envelope>

How to validate part of message in WSOESB and choose first?

Here is how it works.
I do have dss service that returns message of format
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dss="https://rmis33.r-mis.ru/services/dss">
<soapenv:Header/>
<soapenv:Body>
<dss:Requests>
<dss:Request>...</dss:Request>
<dss:Request>...</dss:Request>
<dss:Request>...</dss:Request>
....
<dss:Request>...</dss:Request>
</dss:Requests>
</soapenv:Body>
</soapenv:Envelope>
I have to split message on Request element and validate it, then choose first that pass validation over XSD.
It is hard to do on database level because it has a lot of elements(sub-elements) and XSD was already provided.
You can use validate mediator to validate XML messages against XML schema.There is a complete sample which demonstrates validating messages.

WCF Client adds namespace to XML before parsing

I'm currently implementing a WCF Client app which consumes a Java webservice that uses SOAP as the communication protocol. I generated a proxy from the WSDL provided by the server and when I make calls everything runs through without an error but the received list contains no elements.
I've looked at the incoming XML with Wireshark and WCF tracing/message logging and therefore can be certain that I do receive the intended data. But it seams that the WCF Client somehow manipulates the XML before parsing by inserting an empty namespace which prevents the deserializer from creating the objects from the xml.
Wireshark
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Header/>
<SOAP-ENV:Body xmlns:ns="stat">
<ns:mt_getStation>
<ROW>
<Station_ID>96</Station_ID>
<Station>Station Test</Station>
<Timestamp>2014-09-15T14:00:35</Timestamp>
</ROW>
<ROW>
<Station_ID>42</Station_ID>
<Station>Answer Station Test</Station>
<Timestamp>2014-09-15T14:00:35</Timestamp>
</ROW>
</ns:mt_getStation>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
WCF Message log
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Header></SOAP-ENV:Header>
<SOAP-ENV:Body xmlns:ns="stat">
<ns:mt_getStation>
<ROW xmlns="">
<Station_ID>96</Station_ID>
<Station>Station Test</Station>
<Timestamp>2014-09-15T14:00:35</Timestamp>
</ROW>
<ROW xmlns="">
<Station_ID>42</Station_ID>
<Station>Answer Station Test</Station>
<Timestamp>2014-09-15T14:00:35</Timestamp>
</ROW>
</ns:mt_getStation>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
How can I prevent the WCF client from inserting the empty namespaces?

Delphi 7 and WCF. Complex type problem

I have a WCF service based on basicHTTPBinding. I am calling this service from Delphi 7 and .NET form. The D7 client is able to successfully call the Operation that has primitive input and output type. However, when an operation with complex type is called, the web service receives the complex type as NULL. .Net client is working fine. Here hare the Request headers retrieved from Fiddler.
Delphi client
<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<GetDataUsingDataContract xmlns="http://tempuri.org/">
<composite xmlns="http://schemas.datacontract.org/2004/07/DelphiService2">
<BoolValue>true</BoolValue>
<StringValue>Test</StringValue>
</composite>
</GetDataUsingDataContract>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
.Net Client
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<GetDataUsingDataContract xmlns="http://tempuri.org/">
<composite xmlns:a="http://schemas.datacontract.org/2004/07/DelphiService2" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:BoolValue>true</a:BoolValue>
<a:StringValue>test</a:StringValue>
</composite>
</GetDataUsingDataContract>
</s:Body>
</s:Envelope>
Your issue is caused by the Delphi client putting the composite element being defined in the "http://tempuri.org/" XML namespace instead of the "http://schemas.datacontract.org/2004/07/DelphiService2" namespace. The composite, BoolValue & StringValue elements all need to be defined in the "http://schemas.datacontract.org/2004/07/DelphiService2" XML namespace (prefixed with the namespace alias "a:" in this case).
One way to solve this issue if the Delphi client serializer can't be tweaked is to replace the WCF supplied default namespaces of "http://tempuri.org/" and "http://schemas.datacontract.org/2004/07/DelphiService2" with one you define yourself. Tweak the service contract to conform to the changes outlined in this post and also change the DataContracts to match the new XML namespace. This way all the service defined operations and objects will be in the same XML namespace.
[DataContract(Namespace="http://YourNamespace/2011/09/DelphiService2")]
public class composite
{
public bool BoolValue {get; set;}
public string StringValue {get; set;}
}