SOAP uploading service using C#/Wcf - c#

I need to create a SOAP service that accepts a document of certain kind. The document has XSD schema and such. However, a service that accepts that document (I need to re-create an existing service) provides the following call template (URL removed from xmlns):
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:p="url">
<soapenv:Header/>
<soapenv:Body>
<p:upload>
<!--Optional:-->
<p:sender>?</p:sender>
<!--Optional:-->
<p:type>?</p:type>
<!--Optional:-->
<p:data>cid:1376273768452</p:data>
<!--Optional:-->
<p:version>?</p:version>
<!--Optional:-->
<p:filename>?</p:filename>
<!--Optional:-->
<p:deliveryDate>?</p:deliveryDate>
<!--Optional:-->
<p:messageId>?</p:messageId>
</p:upload>
</soapenv:Body>
</soapenv:Envelope>
Please advice me what sort of request is that (I suspect some upload request with an attachment) and how possibly I can upload a given document using this format; how I can create such a service using C#/ WCF. Appreciate any pointers.

Related

Move alias in xml created by SOAP Client (connected services)

I created the service starting from a wsdl (copied locally).
The client created creates an xml that is not equal to what the service expects.
This is what should come out
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:iuv="http://dcod.xxxx.it/iuv/">
<soapenv:Header/>
<soapenv:Body>
<iuv:annullo>
<arg0>
<iuv>-1</iuv>
</arg0>
</iuv:annullo>
</soapenv:Body>
</soapenv:Envelope>
This is what the client produces
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<annullo xmlns="http://dcod.xxxx.it/iuv/">
<arg0>
<iuv>-1</iuv>
</arg0>
</annullo>
</s:Body>
</s:Envelope>
In particular
<annullo xmlns = "http://dcod.xxxx.it/iuv/">
it should become
<iuv:annullo>
What to change?

How change namespace and prefix in WCF

My customer wants to a web service for integration. They send me the documentation and I created a WCF Service with methods.
But there are namespaces and prefixs problem. I didn't find any solution and I didn't find any suggest. For example there is a different tag (
Customer will send request like this:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ws="http://ws.common.haciosman.com">
<soapenv:Header />
<soap:Body>
<ws:getSystemStatus/>
</soap:Body>
</soap:Envelope>
Customer wants to response like that:
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Header/>
<soapenv:Body>
<ns:getSystemStatusResponse xmlns:ns="http://ws.common.haciosman.com">
<ns:return xsi:type="ax21:OutputMessage" xmlns:ax21="http://ws.common.haciosman.com/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ax21:code>200</ax21:code>
<ax21:description>Success</ax21:description>
</ns:return>
</ns:getSystemStatusResponse>
</soapenv:Body>
</soapenv:Envelope>
Okay, I created a service but namespace and prefix not match. My service response like that:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<getSystemStatusResponse>
<getSystemStatusResult xmlns:a="http://schemas.datacontract.org/2004/07/WCFLocal.cls" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:code>200</a:code>
<a:description>Success</a:description>
</getSystemStatusResult>
</getSystemStatusResponse>
</s:Body>
</s:Envelope>
As you see, tags are different. What is wrong and how can I change prefix in WCF Service?
Thanks for your reply.

How do I send TimeSpan parameter on SoapUI request?

I'm trying to send a TimeSpan parameter with value 01:00:00 and getting the following error:
There was an error when deserializing the object of type MyObject. The value '01:00:00' can't be parsed as type 'TimeSpan'.
How do I write this parameter for success on deserialization ?
Here's my request (Look at parameter 'Time'):
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tel="http://service.example/" xmlns:ent="http://schemas.datacontract.org/2004/07/Service.Contract">
<soapenv:Header/>
<soapenv:Body>
<tel:InsertObject>
<!--Optional:-->
<tel:object>
<!--Optional:-->
<ent:Date>2018-02-15T11:05:00</ent:Date>
<!--Optional:-->
<ent:Time>01:00:00</ent:Time>
<!--Optional:-->
<ent:ID>0</ent:ID>
<!--Optional:-->
<ent:Name>TestName</ent:Name>
</tel:object>
</tel:InsertObject>
</soapenv:Body>
</soapenv:Envelope>
Thanks!
I've found the solution.
For 01:00:00 ->
<ent:Time>PT1H</ent:Time>
For 01:20:00 ->
<ent:Time>PT1H20M</ent:Time>
For 00:02:45 ->
<ent:Time>PT2M45S</ent:Time>
For 01:20:45 ->
<ent:Time>PT1H20M45S</ent:Time>

Set custom tag in WSDL + WCF

Is possible to convert this fragment of wsdl:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:com="http://com.lsc.services.financialSystem">
<soapenv:Header/>
<soapenv:Body>
<com:crearCuentaPorCobrar>
<!--Optional:-->
<com:crearCuentaPorCobrarRq>
<com:infoRequest>
<com:RequestID>?</com:RequestID>
<com:Fecha>?</com:Fecha>
<com:AplicacionCliente>?</com:AplicacionCliente>
<com:Terminal>?</com:Terminal>
<com:IP>?</com:IP>
</com:infoRequest>
</com:crearCuentaPorCobrarRq>
</com:crearCuentaPorCobrar>
</soapenv:Body>
</soapenv:Envelope>
To this solution:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:com="http://com.lsc.services.financialSystem">
<soapenv:Header/>
<soapenv:Body>
<com:crearCuentaPorCobrar>
<!--Optional:-->
<crearCuentaPorCobrarRq>
<infoRequest>
<RequestID>?</com:RequestID>
<Fecha>?</com:Fecha>
<AplicacionCliente>?</com:AplicacionCliente>
<Terminal>?</com:Terminal>
<IP>?</com:IP>
</infoRequest>
</crearCuentaPorCobrarRq>
</com:crearCuentaPorCobrar>
</soapenv:Body>
</soapenv:Envelope>
You can observe that in the second WSDL I don't want to use the index: 'com' to its subitems, only in its container (crearCuentaPorCobrar). I observe another posts like: Controlling WCF response format and namespaces but this is not mi interest to establish more code on wsdl.
There is a way to build this???
Thk a lot!!!

How do I remove operation element from soap body in WCF?

I have wcf services using .net framework 4.0, all setting is default of visual studio WCF project
namespace ApiFrame{
[ServiceContract(Namespace="http://abc.com.vn/")]public interface IApiframe
{
[OperationContract(Name = "process", Action="")]
string testprocess(string request);
this is what my service result (based on SOAPUI):
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="http://abc.com.vn/">
<soapenv:Header/>
<soapenv:Body>
<api:testprocess><!-- I want to remove this! -->
<!--Optional:-->
<api:request></api:request>
</api:testprocess><!-- I want to remove this! -->
</soapenv:Body>
</soapenv:Envelope>
I want to remove <api:process> xml tag.

Categories

Resources