How do I send TimeSpan parameter on SoapUI request? - c#

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>

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 to customize ASP.NET Websevices SOAP?

I need a SOAP webservice can receive quest like
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:vas=" http://vasgate.mobifone.vn ">
<soapenv:Header/>
<soapenv:Body>
<vas:register>
<msisdn>904919419</msisdn>
<packagecode>PACK1</packagecode>
<username>kenh1</username>
<password>kenh#123</password>
<channel>wapportal</channel>
<info>khuyenmai</info>
</vas:register>
</soapenv:Body>
</soapenv:Envelope>
And can response like
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body >
<ns2: registerResponse xmlns:ns2="http://vasgate.mobifone.vn" >
<return>
<returncode>1</ returncode >
<returndesc>DANG_KY_THANH_CONG</returndesc>
<package>
<packagecode>PACK1</packagecode>
<cycle>1</cycle>
<price>1000</price>
<desc>sample package1</desc>
</package>
</return>
</ns2:registerResponse>
How to customize my webservice to do this?

SOAP uploading service using C#/Wcf

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.

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