Note that there are some explanatory texts on larger screens.

plurals
  1. POPowershell: Error consuming WCF services with MTOM message encoding
    primarykey
    data
    text
    <p>I'm currently exploring powershell capabilities, but I have encountered a problem that I have not been able to solve. Any quick tips would be greatly appreciated =)</p> <p>My goal: Invoke methods from a WCF service (configured with MTOM message encoding) from powershell v2.0 (hopefully using the new-webserviceproxy cmdlet)</p> <p>My problem: the new-webserviceproxy cmdlet cannot parse the service's response correctly when message encoding is set to Mtom. I receive the following error:</p> <p><strong>PowerShell</strong>: </p> <p><code> $proxyObject = New-WebServiceProxy -URI "<a href="http://myserver.com/AccessService.svc?wsdl" rel="noreferrer">http://myserver.com/AccessService.svc?wsdl</a>"<br> $proxyObject.TestWebServiceConnection() </code></p> <blockquote> Exception calling "TestWebServiceConnection" with "0" argument(s): "Client found response content type of 'multipart/related; type="application/xop+xml";start="&lthttp://tempuri.org/0&gt";boundary="uuid: <br/>4001d529-32b9-4560-9f4b-550c35c67b03+id=4";start-info="text/xml"', but expected 'text/xml'. <br/>The request failed with the error message: <br/>-- <br/>--uuid:4001d529-32b9-4560-9f4b-550c35c67b03+id=4 <br/>Content-ID: &lthttp://tempuri.org/0&gt <br/>Content-Transfer-Encoding: 8bit <br/>Content-Type: application/xop+xml;charset=utf-8;type="text/xml" <br/>&lts:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt <br/>&lts:Body&gt <br/>&ltTestWebServiceConnectionResponse xmlns="http://myserver.com/"&gt <br/>&ltTestWebServiceConnectionResult&gtsuccess&lt/TestWebServiceConnectionResult&gt <br/>&lt/TestWebServiceConnectionResponse&gt <br/>&lt/s:Body&gt <br/>&lt/s:Envelope&gt <br/>--uuid:4001d529-32b9-4560-9f4b-550c35c67b03+id=4-- <br/>--." <br/>At line:1 char:38 <br/>+ $proxyObject.TestWebServiceConnection &lt&lt&lt&lt () &gt&gt error.txt <br/> + CategoryInfo : NotSpecified: (:) [], MethodInvocationException <br/> + FullyQualifiedErrorId : DotNetMethodException </blockquote> <p><strong>Note</strong> I am able to consume the WCF service through other clients and even the wcfclient tool provided by Microsoft. You can see that the <strong>TestWebServiceConnectionResult</strong> returned <em>success</em>, but it doesn't seem like the proxy object was able to parse the response. </p> <p><strong>Behavior</strong>:</p> <blockquote> &ltserviceBehaviors&gt <br/> &ltbehavior name="MyServiceBehavior"&gt <br/> &ltserviceThrottling maxConcurrentCalls="100" maxConcurrentSessions="100"/&gt <br/> &ltserviceMetadata httpGetEnabled="true" httpsGetEnabled="false"/&gt <br/> &ltserviceDebug includeExceptionDetailInFaults="false"/&gt <br/> &lt/behavior&gt <br/>&lt/serviceBehaviors&gt </blockquote> <p><strong>Binding</strong>(I've excluded the timeout values/ reader quota and message sizes since the permutations of their values do seem not relevant to my problem):</p> <blockquote> <br/>&ltbasicHttpBinding&gt <br/> &ltbinding name="basicHttpEndpointBinding" messageEncoding="Mtom"&gt <br/> &ltsecurity mode="None"&gt <br/> &lttransport clientCredentialType="None"/&gt <br/> &lt/security&gt <br/>&lt/basicHttpBinding&gt </blockquote> <p><strong>Service</strong> </p> <blockquote> &ltservice behaviorConfiguration="MyServiceBehavior" name="MyService.AccessService"&gt <br/> &ltendpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpEndpointBinding" name="basicHttpEndpointAccessService" bindingNamespace="http://myserver.com/" contract="MyService.IAccessService"/&gt <br/> &ltendpoint address="mex" binding="basicHttpBinding" bindingConfiguration="basicHttpEndpointBinding" name="mexEndpointAccess" contract="IMetadataExchange"/&gt <br/>&lt/service&gt </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload