In a WCF message, is maxDepth calculated beginning with the soap envelope element?
For example, is the following message considered 5 levels deep?
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<ExecuteResponse xmlns="http://tempuri.org/">
<ExecuteResult>
<res>0</res>
</ExecuteResult>
</ExecuteResponse>
</soap:Body>
</soap:Envelope>
Went ahead and tested it. The calculation starts with the envelope node being level 1.
The following message throws an exception if maxDepth is set to 7. It succeeds if maxDepth is set to 8.
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="1">http://ws.lhotka.net/WcfDataPortal/IWcfPortal/Update</a:Action>
<a:MessageID>urn:uuid:423cf7a3-18b7-47e8-a9f3-399e51db6b34</a:MessageID>
<ActivityId CorrelationId="3716b91d-7552-4cba-8cfd-649ef7e1a1c3" xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">c26b4ac3-3327-48ad-ac84-7dc56a241b57</ActivityId>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<a:To s:mustUnderstand="1">http://localhost/Callisto/WcfAppServer.svc</a:To>
</s:Header>
<s:Body>
<Update xmlns="http://ws.lhotka.net/WcfDataPortal">
<request z:Id="1" z:Type="Csla.Server.Hosts.WcfChannel.UpdateRequest" z:Assembly="Csla, Version=3.8.3.0, Culture=neutral, PublicKeyToken=93be5fdc093e4c30" xmlns:b="http://schemas.datacontract.org/2004/07/Csla.Server.Hosts.WcfChannel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/">
<b:_context z:Id="2" xmlns:c="http://schemas.datacontract.org/2004/07/Csla.Server">
<c:_clientContext i:nil="true" xmlns:d="http://schemas.microsoft.com/2003/10/Serialization/Arrays"></c:_clientContext>
<c:_clientCulture z:Id="3">en-US</c:_clientCulture>
<c:_clientUICulture z:Ref="3" i:nil="true"></c:_clientUICulture>
<c:_globalContext i:nil="true" xmlns:d="http://schemas.microsoft.com/2003/10/Serialization/Arrays"></c:_globalContext>
<c:_principal z:Id="4" z:Type="System.Security.Principal.GenericPrincipal" z:Assembly="0">
<m_identity z:Id="5" z:Type="System.Security.Principal.GenericIdentity" z:Assembly="0" xmlns="http://schemas.datacontract.org/2004/07/System.Security.Principal">
<m_name z:Id="6"></m_name>
<m_type z:Ref="6" i:nil="true"></m_type>
</m_identity>
<m_roles z:Id="7" z:Size="1" xmlns="http://schemas.datacontract.org/2004/07/System.Security.Principal" xmlns:d="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d:string z:Ref="6" i:nil="true"></d:string>
</m_roles>
</c:_principal>
<c:_remotePortal>true</c:_remotePortal>
</b:_context>
<b:_object z:Id="8" z:Type="Callisto.Business.Commands.InitializeServerSystemSettings" z:Assembly="Callisto.Business, Version=0.0.28.0, Culture=neutral, PublicKeyToken=null">
<_fieldManager i:nil="true" xmlns="http://schemas.datacontract.org/2004/07/Csla.Core" xmlns:c="http://schemas.datacontract.org/2004/07/Csla.Core.FieldManager"></_fieldManager>
<mbResult xmlns="http://schemas.datacontract.org/2004/07/Callisto.Business.Commands">false</mbResult>
</b:_object>
</request>
</Update>
</s:Body>
</s:Envelope>
Related
I am working with this SOAP web service in a .NET Framework project. I inspect the XML content of requests and responses, and everything looks good. But the SOAP client (the one Visual Studio creates via Connected Services thing) does not map the response correctly to the entity class.
Here is the request XML.
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">OrderList</Action>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<OrderListRequest xmlns="http://www.n11.com/ws/schemas">
<auth xmlns="">
<appKey>**redacted**</appKey>
<appSecret>**redacted**</appSecret>
</auth>
<searchData xmlns="">
<productId xsi:nil="true" />
<status xsi:nil="true" />
<orderNumber>**redacted**</orderNumber>
<productSellerCode xsi:nil="true" />
<sameDayDelivery xsi:nil="true" />
<sortForUpdateDate>false</sortForUpdateDate>
</searchData>
<pagingData xsi:nil="true" xmlns="" />
</OrderListRequest>
</s:Body>
</s:Envelope>
And here is the response.
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header />
<env:Body>
<ns3:OrderListResponse xmlns="" xmlns:ns3="http://www.n11.com/ws/schemas">
<result>
<status>success</status>
</result>
<pagingData>
<currentPage>0</currentPage>
<pageSize>100</pageSize>
<totalCount>1</totalCount>
<pageCount>1</pageCount>
</pagingData>
<orderList>
<order>
<citizenshipId>**redacted**</citizenshipId>
<createDate>02/10/2020 14:46</createDate>
<id>**redacted**</id>
<orderNumber>**redacted**</orderNumber>
<paymentType>1</paymentType>
<status>2</status>
</order>
</orderList>
</ns3:OrderListResponse>
</env:Body>
</env:Envelope>
As it is visible in the response XML, I get all the information I want perfectly. But as you can see in the screenshot below, all I'm getting in the response object is the citizenshipId, and everything else is either null or the default value for its type.
What could be the problem here? I'm a newbie in .NET so I don't even know how to Google this. I tried a few searches but nothing yielded any related results.
The WSDL is publicly available at https://api.n11.com/ws/OrderService.wsdl.
Good Afternoon,
We have been trying to consume a Carrier API, but have hit some issue with the WSDL Generation. The Example XML message the company has provided has ns1-3 and appears that it is important for the address fields. the XML generated from their WSDL seems to generate the same fields but has no name spaces like the original and fails with "Address details are invalid", Is there some setting we are missing so that it generates the correct XML?
This is their Example XML
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns3:CreateLabel xmlns:ns3="http://courier.ck.dx.metafour.com/" xmlns:ns2="http://www.thedx.co.uk/eai/canonical/types/v2.0">
<order>
<ns2:customerID>14337622</ns2:customerID>
<ns2:dates>
<date format="yyyy-MM-dd HH:mm:ss" type="requestedCollectionDate">2018-12-12 17:59:21</date>
</ns2:dates>
<sourceSystemReference xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0">AMS207554</sourceSystemReference>
<customerReference xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0">286956</customerReference>
<orderAttributes xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0" xsi:nil="true" />
<ns2:orderLines>
<ns2:consignment>
<pieces>
<dimensions>
<value>1.0</value>
<type>cdlWeight</type>
<UOM>KG</UOM>
</dimensions>
<barcode xsi:nil="true" />
<trackingNumber xsi:nil="true" />
</pieces>
<qty>1</qty>
<legacyService>
<name>serviceLevel</name>
<partyId>0</partyId>
<partyType>HITS</partyType>
</legacyService>
<legacyService>
<name>serviceType</name>
<partyId>2</partyId>
<partyType>HITS</partyType>
</legacyService>
<deliverTo>
<ns2:address primary="true">
<organisationName>Argos</organisationName>
<addressLine1>Argos</addressLine1>
<addressLine2>Argos Ltd</addressLine2>
<addressLine3>11 Canning Street</addressLine3>
<city>BURNLEY</city>
<postalCode>BB12 0AD</postalCode>
<country>
<countryCode>GB</countryCode>
<description>GB</description>
</country>
</ns2:address>
<contact />
</deliverTo>
</ns2:consignment>
</ns2:orderLines>
<labelType>ZPL</labelType>
</order>
<serviceHeader>
<password>test</password>
<userId>test</userId>
</serviceHeader>
</ns3:CreateLabel>
</s:Body>
</s:Envelope>
This is our Generated XML
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<CreateLabel xmlns="http://courier.ck.dx.metafour.com/">
<order xmlns="">
<customerID xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0">14337622</customerID>
<dates xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0">
<date xmlns="" format="yyyy-MM-dd HH:mm:ss" type="requestedCollectionDate">2019-01-25 10:17:33</date>
</dates>
<sourceSystemReference xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0">AMS207554</sourceSystemReference>
<customerReference xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0">286956</customerReference>
<orderAttributes xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0" xsi:nil="true" />
<orderLines xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0">
<consignment>
<pieces xmlns="">
<dimensions>
<value>1.0</value>
<type>cdlWeight</type>
<UOM>KG</UOM>
</dimensions>
<barcode xsi:nil="true" />
<trackingNumber xsi:nil="true" />
</pieces>
<qty>1</qty>
<legacyService xmlns="">
<name>serviceLevel</name>
<partyId>0</partyId>
<partyType>HITS</partyType>
</legacyService>
<legacyService xmlns="">
<name>serviceType</name>
<partyId>2</partyId>
<partyType>HITS</partyType>
</legacyService>
<deliverTo xmlns="">
<address xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0">
<organisationName xmlns="">Argos</organisationName>
<addressLine1 xmlns="">Argos</addressLine1>
<addressLine2 xmlns="">Argos Ltd</addressLine2>
<addressLine3 xmlns="">11 Canning Street</addressLine3>
<city xmlns="">BURNLEY</city>
<postalCode xmlns="">BB12 0AD</postalCode>
<country xmlns="">
<countryCode>GB</countryCode>
<description>GB</description>
</country>
</address>
<contact xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0" />
</deliverTo>
</consignment>
</orderLines>
<labelType>ZPL</labelType>
</order>
<serviceHeader xmlns="">
<password>test</password>
<userId>test</userId>
</serviceHeader>
</CreateLabel>
</s:Body>
</s:Envelope>
Any help would be greatly appreciated!
This is resolved,
I could not figure out a way to change or add additional namespace to the generated references.cs file, and ended up sending the SOAP to their server manually with an XML string serialized using a httpWebRequest and XmlSerializer
I can send the Basic Authentication request within the xml itself without even writing something like
request.headers.add("");
and adding like this
<?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:Header>
<Authentication xmlns="http://tempuri.org/">
<Password>string</Password>
<UserName>string</UserName>
</Authentication>
</soap:Header>
<soap:Body>
<HelloWorld xmlns="http://tempuri.org/" />
</soap:Body>
</soap:Envelope>
Similarly I want to set the SOAPAction within the header xml itself instead of writing
request.headers.add("SOAPAction","someAction");
Somewhat like this
<?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:Header>
<SOAPAction>http://abc/xyz/test</SOAPAction>
<Authentication xmlns="http://tempuri.org/">
<Password>string</Password>
<UserName>string</UserName>
</Authentication>
</soap:Header>
<soap:Body>
<HelloWorld xmlns="http://tempuri.org/" />
</soap:Body>
</soap:Envelope>
Please guide me that How it can be achieved?
Given an Attendee in EWS, how can I determine if that attendee is a room or a resource, instead of a person?
The first thing would be just check if the Attendee is in the Resources Strongly typed property https://msdn.microsoft.com/en-us/library/exchangewebservices.calendaritemtype.resources(v=exchg.80).aspx if your getting a Calendar Item using EWS this is where Rooms and Resources will be returned vs Required and optional attendees.
If the Attendee is in the Global Address list and you have 2013 or greater then you can also use FindPeople and check the PersonaType returned eg
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
xmlns="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
<soap:Header>
<t:RequestServerVersion Version="Exchange2013" />
</soap:Header>
<soap:Body >
<m:FindPeople>
<m:PersonaShape>
<t:BaseShape>Default</t:BaseShape>
</m:PersonaShape>
<m:IndexedPageItemView BasePoint="Beginning" MaxEntriesReturned="100" Offset="0"/>
<m:ParentFolderId>
<t:DistinguishedFolderId Id="directory"/>
</m:ParentFolderId>
<m:QueryString>Adams#ddddd.onmicrosoft.com</m:QueryString>
</m:FindPeople>
</soap:Body>
</soap:Envelope>
should return something like the following for a room
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="15" MinorVersion="1" MajorBuildNumber="629" MinorBuildNumber="8" Version="V2016_07_13" 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" />
</s:Header>
<s:Body>
<FindPeopleResponse ResponseClass="Success" xmlns="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">
<ResponseCode>NoError</ResponseCode>
<People>
<Persona xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
<PersonaId Id="AAUQAGDlxBsmUDpClBbAI1WX04o=" />
<PersonaType>Room</PersonaType>
<CreationTime>0001-01-02T00:00:00Z</CreationTime>
<DisplayName>Conf Room Adams</DisplayName>
<DisplayNameFirstLast>Conf Room Adams</DisplayNameFirstLast>
<DisplayNameLastFirst>Conf Room Adams</DisplayNameLastFirst>
<FileAs />
<EmailAddress>
<Name>Conf Room Adams</Name>
<EmailAddress>Adams#dddddd.onmicrosoft.com</EmailAddress>
<RoutingType>SMTP</RoutingType>
<MailboxType>Mailbox</MailboxType>
</EmailAddress>
<EmailAddresses>
<Address>
<Name>Conf Room Adams</Name>
<EmailAddress>Adams#dddddd.onmicrosoft.com</EmailAddress>
<RoutingType>SMTP</RoutingType>
<MailboxType>Mailbox</MailboxType>
</Address>
</EmailAddresses>
<RelevanceScore>2147483647</RelevanceScore>
</Persona>
</People>
<TotalNumberOfPeopleInView>0</TotalNumberOfPeopleInView>
<FirstMatchingRowIndex>0</FirstMatchingRowIndex>
<FirstLoadedRowIndex>0</FirstLoadedRowIndex>
</FindPeopleResponse>
</s:Body>
</s:Envelope>
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)