Am I able to change the namespace in all SOAP web service methods, without editing the code?
This line...
<ConfirmIdentity xmlns="http://www.domain.com"> ?
is this possible?
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ConfirmIdentity xmlns="http://www.domain.com">
<ConfirmIdentityRequest>
<ApplicationCrediential>
<API_Username>string</API_Username>
<API_Password>string</API_Password>
</ApplicationCrediential>
<SessionId>string</SessionId>
</ConfirmIdentityRequest>
</ConfirmIdentity>
</soap:Body>
</soap:Envelope>
To my knowledge you cannot change the namespace, it is set in the context of the class and method. Even if you somehow wrapped this from another, it would still override. You're only option is a proxy consumer.
Related
Any ideas why exchange keeps throwing this error?
I'm using Microsoft Exchange Managed API 2.0, from C#.
The sample request and responses are intercepted using Fiddler
I'll post a request and response sample.
I even tried to remove all properties and leave just a simple one, and still same error.
It doesn't seem to be a collections related issue
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<t:RequestServerVersion Version="Exchange2013_SP1" />
</soap:Header>
<soap:Body>
<m:UpdateItem MessageDisposition="SaveOnly" ConflictResolution="AlwaysOverwrite">
<m:ItemChanges>
<t:ItemChange>
<t:ItemId Id="AAMkADgwNWY5NDQ3LWRkMTQtNGQyZS04ODMxLTQzMDQ1NWU5NTI2OABGAAAAAADzrqMpUzgAQoRJwq9Jq9ArBwDjC+q0IBppSKdYNLEIzckAAADAlx38AADjC+q0IBppSKdYNLEIzckAAADAly/BAAA=" ChangeKey="EQAAABYAAADjC+q0IBppSKdYNLEIzckAAADAis/g" />
<t:Updates>
<t:SetItemField>
<t:FieldURI FieldURI="contacts:GivenName" />
<t:Contact>
<t:GivenName>Mickeyaabsbbcdsf</t:GivenName>
</t:Contact>
</t:SetItemField>
<t:SetItemField>
<t:FieldURI FieldURI="contacts:FileAs" />
<t:Contact />
</t:SetItemField>
<t:DeleteItemField>
<t:FieldURI FieldURI="contacts:FileAs" />
</t:DeleteItemField>
</t:Updates>
</t:ItemChange>
</m:ItemChanges>
</m:UpdateItem>
</soap:Body>
</soap:Envelope>
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" MajorVersion="15" MinorVersion="20" MajorBuildNumber="2241" MinorBuildNumber="12" Version="V2018_01_08"/>
</s:Header>
<s:Body>
<m:UpdateItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:UpdateItemResponseMessage ResponseClass="Error">
<m:MessageText>An object within a change description must contain one and only one property to modify.</m:MessageText>
<m:ResponseCode>ErrorIncorrectUpdatePropertyCount</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
<m:MessageXml>
<t:Value Name="PropertyCount">0</t:Value>
<t:Value Name="PropertyInfo"/>
</m:MessageXml>
<m:Items/>
</m:UpdateItemResponseMessage>
</m:ResponseMessages>
</m:UpdateItemResponse>
</s:Body>
</s:Envelope>
Turns out the problem is, I am performing 2 operations on the "FileAs" field.
At some point in the code I assigned a value to it, use that value somewhere else in the flow, and then making it null, like it was.
This, in turns, triggers a state change in the object that holds the property.
The contact objects sees that I did an assignment, and then a null, which equals deleting the value.
This double state change is confusing for exchange, because it doesn't know which of the 2 state changes is the correct one that should be persisted in Exchange, therefore, triggering that error.
So all in all, avoid doing this in the code!
contact.FileAs = "SomeValue"
........
contact.FileAs = null;
You can also see the confusing effect it has on the request xml (it does a set item field, with no value, and then a delete item field)
<t:SetItemField>
<t:FieldURI FieldURI="contacts:FileAs" />
<t:Contact />
</t:SetItemField>
<t:DeleteItemField>
<t:FieldURI FieldURI="contacts:FileAs" />
</t:DeleteItemField>
I am trying to consume a service .
Can any one help me how to generate a soap request as follows.
i want to construct a class and then serialize the class using soap formator and then post it to my service. I tried with the some online help but could not able to generate the required soap xml.
i am bit confused about the implementation .Can any one help me on this.
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:iot="http://services.singp.com>
<soapenv:Header/>
<soapenv:Body>
<iot.performService>
<iot.input>
<iot.gsh><![CDATA[
<header xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://services.singp.com">
<GUID></GUID>
<CustID></CustID>
<RequestName></RequestName>
<TimeStamp>2017-06-09T10:49:03.49-05:00</TimeStamp>
</header>
]]></iot.gsh>
<iot.Body><![CDATA[
<CustStatus xmlns="http://services.singp.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<CustStatusAttributes>
<CustID>str1234</CustID>
<Action>str1234</Action>
</CustStatusAttributes>
<CustStatusInformation>
<ClientOrderNumber>745</ClientOrderNumber>
</CustStatusInformation>
</CustStatus>
]]></iot.Body>
</iot.input>
</iot.performService>
</soapenv:Body>
</soapenv:Envelope>
I use WCF to implement a client for a SOAP web service. The code is generated by "Add Service Reference" based on the WSDL file.
The elements of the SOAP request are defined in different namespaces.
Now, a sample message looks like this:
<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">
<myMethod xmlns="http://example.org/xsd/requests">
<RequestData>
<Foo xmlns="http://example.org/xsd/elements">some</Foo>
<Bar xmlns="http://example.org/xsd/elements">thing</Bar>
<Baz xmlns="http://example.org/xsd/elements">content</Baz>
<!-- .... more elements .... -->
</RequestData>
</myMethod>
</s:Body>
</s:Envelope>
which contains the redundant definition of the elements namespace. In order to reduce message size, I would prefer to have the namespace definitions at the top of the message, eg. like this:
<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"
xmlns:a="http://example.org/xsd/requests"
xmlns:b="http://example.org/xsd/elements">
<a:myMethod>
<a:RequestData>
<b:Foo>some</b:Foo>
<b:Bar>thing</b:Bar>
<b:Baz>content</b:Baz>
<!-- .... more elements .... -->
</a:RequestData>
</a:myMethod>
</s:Body>
</s:Envelope>
(I don't really care which parent element defines the namespaces, so any way to move the namespace definitions to Envelope, Body or MyMethod would be okay for me.)
How can I achieve this?
EDIT: removed local xmlns definitions in second example (copy-paste mistake ;) )
I have tried to test my svc service with SoapUI, but when I create the request, the method is been added like a part of him. but is not part of the request.
There's anyone know how to fixed ?
Here is an example of my request
<soap:Body>
<findSchedule> <!--findSchedule is the part that i want to remove-->
<request>
...
</request>
</findSchedule>
</soap:Body>
This is how the request has to look like.
<soap:Body>
<request>
...
</request>
</soap:Body>
Is it possible to remove the what appears to be automatic notificationRequestResponse node from the response?
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
...
<soap:Body>
<notificationRequestResponse xmlns="...">
<notificationResponse xmlns="...">
<success xmlns="">boolean</success>
<fault xmlns="">
...
</fault>
</notificationResponse>
</notificationRequestResponse>
</soap:Body>
</soap:Envelope>
I need to return the below:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
...
<soap:Body>
<notificationResponse xmlns="...">
<success xmlns="">boolean</success>
<fault xmlns="">
...
</fault>
</notificationResponse>
</soap:Body>
</soap:Envelope>
I want the notificationResponse to be the root of the response!
The WebMethod currently has no logic but:
return new notificationResponse()
Where is the notificationRequestResponse coming from? I can rename it using WebMethod SoapDocumentMethod(ResponseElementName="new name") but I want it gone. Working to a provided spec and have no choice.
Appreciated.
Found the answer...
SoapDocumentMethod(ParameterStyle = SoapParameterStyle.Bare)