WCF Client adds namespace to XML before parsing - wcf

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?

Related

How to get id field from http xml response in power automate

How to get id field from http xml response in power automate
<?xml version="1.0" encoding="UTF-8"?>
<ServiceResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://test.qg.apps.test.com/qps/xsd/3.0/was/report.xsd">
<responseCode>SUCCESS</responseCode>
<count>1</count>
<data>
<Report>
<id>3505012</id>
</Report>
</data>
</ServiceResponse>
how can i get outcome 3505012 in result
tried below
#{slice(outputs('createreportxml'), add(nthIndexOf(outputs('createreportxml'), '>', 9), 1), nthIndexOf(outputs('createreportxml'), '<', 10))}
as well as below
xpath(xml(outputs('#{outputs('createreportxml')}'))), 'string(/ServiceResponse/data/Report/id/text())'
sample flow
Got it working with below has small issue with one braces.
#{xpath(xml(outputs('createreportxml')),'string(/ServiceResponse/data/Report/id/text())')}

Magento Customer Update API Error - Cannot use object of type stdClass as array

Hi Im am trying to connect to magento api Customer Update using SOAP UI. I perfectly connect and update products. I can list Customers
but for some reason I can not update a customer. The xml I am using is as follows:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:Magento">
<soapenv:Header/>
<soapenv:Body>
<urn:customerCustomerUpdateRequestParam>
<sessionId>65e47ee067bba9c51b97c8d80929a138</sessionId>
<customerId>1</customerId>
<customerData>
<email>33#ddd.com</email>
</customerData>
</urn:customerCustomerUpdateRequestParam>
</soapenv:Body>
</soapenv:Envelope>
And the response I get is the following:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>Cannot use object of type stdClass as array</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Can any one shed some light on this?
Thanks.

Error registering Yodlee user, can't getWrappedExceptions

I'm getting the following error (see Response) while attempting to register a user. The code was working fine before but it seems something changed.
Request:
<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:ns3="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ns0="http://userregistration.usermanagement.core.soap.yodlee.com"
xmlns:ns1="http://common.soap.yodlee.com"
xmlns:ns2="http://login.ext.soap.yodlee.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<ns3:Body>
<ns0:register3>
<cobrandContext xsi:type="ns1:CobrandContext">
<cobrandId>8910005960</cobrandId>
<channelId>-1</channelId>
<locale>
<country>US</country>
<language>en</language>
</locale>
<tncVersion>2</tncVersion>
<applicationId>58EEA306454D869DFF721D0D00B82D00</applicationId>
<cobrandConversationCredentials xsi:type="ns2:SessionCredentials">
<sessionToken>05292013_0:718a0b8d870c13b5be2d2fb14bfd53b3796c5c97b401d68d34fe4594fdefeab3a3e5d6d8ee14696a6e03f53f0da613b781f1be0c8c06e70b883bb9abe232ba9f</sessionToken>
</cobrandConversationCredentials>
<preferenceInfo>
<currencyCode>USD</currencyCode>
<timeZone>PST</timeZone>
<dateFormat>MM/dd/yyyy</dateFormat>
<currencyNotationType>SYMBOL_NOTATION</currencyNotationType>
<numberFormat>
<decimalSeparator>.</decimalSeparator>
<groupingSeparator>,</groupingSeparator>
<groupPattern>###,##0.##</groupPattern>
</numberFormat>
</preferenceInfo>
<currencyCode>USD</currencyCode>
<timeZone>PST</timeZone>
<dateFormat>MM/dd/yyyy</dateFormat>
<currencyNotationType>SYMBOL_NOTATION</currencyNotationType>
<numberFormat>
<decimalSeparator>.</decimalSeparator>
<groupingSeparator>,</groupingSeparator>
<groupPattern>###,##0.##</groupPattern>
</numberFormat>
</preferenceInfo>
<fetchAllLocaleData>false</fetchAllLocaleData>
</cobrandContext>
<userCredentials xsi:type="ns2:PasswordCredentials">
<loginName>someyodleeuser#somedomain.com</loginName>
<password>yodleepasswordtest</password>
</userCredentials>
<userProfile>
<values>
<table>
<key xsi:type="xsd:string">EMAIL_ADDRESS</key>
<value xsi:type="xsd:string">someyodleeuser#somedomain.com</value>
</table>
</values>
</userProfile>
</ns0:register3>
</ns3:Body>
</SOAP-ENV:Envelope>
Response:
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server</faultcode>
<faultstring>IllegalArgumentValueExceptionFaultMessage</faultstring>
<detail>
<ns4:IllegalArgumentValueExceptionFault xmlns:ns4="http://core.soap.yodlee.com">
<faultText>com.yodlee.core.IllegalArgumentValueException: Multiple exceptions encapsulated within: invoke getWrappedExceptions for details</faultText>
</ns4:IllegalArgumentValueExceptionFault>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
Problem is, I'm not getting back any details on the exception to debug the issue (Even when doing as suggested).
Your password is not in the right format and hence you are getting this error.
Below are the restrictions on username and password which you should follow -
UserName
>= 3 characters <= 150 characters
pNo Whitespace
No Control Characters
Contains at least one Letter
Password
>= 6 characters
<= 50 characters
No Whitespace
No Control Characters
Contains at least one Number
Contains at least one Letter
Does not contain the same letter/number three or more times in a row. (e.g. aaa123 would fail for three \"a\"'s in a row, but a1a2a3 would pass)"); Does not equal username

Can WCF be configured to 'refactor' the XMLSchema-instance namespace on a Serialized message?

We have noted that WCF DataContractSerializer isn't very efficient when it comes to serializing null values during an SOAP call. For audit purposes, we also record the exact message as sent to disk, so this wastes storage. A typical message with more than one nil element is sent like so:
<MyMessage xmlns="myXmlns">
<field0>1234567</field0>
<field1 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
<field2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
<field3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
// etc
</MyMessage>
What would be an immeasurable improvement for bandwidth and disk considerations would be to generate a SOAP body such as:
<MyMessage xmlns="myXmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<field0>1234567</field0>
<field1 xsi:nil="true" />
<field2 xsi:nil="true" />
<field3 xsi:nil="true" />
//etc
</MyMessage>
So my question is, how can I change my WCF client to consolidate the XSI namespace on the root element, to prevent it from being repeated on each nil element?
You can't tweak the serializer, however if you implement a message inspector you can manipulate to your hearts content.
If you want to drop the nulls altogether though, and never see if it's not present you could decorate it
[DataMember(EmitDefaultValue=false)]

WCF Contract from XML Soap file

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....