Page 1 of 1

SOAP WebServiceProxy error

Posted: Fri Apr 07, 2017 3:53 am
by Kilsgaard
HI

I have not that much experience on webservices yet, and have run into a problem, that i cannot find a solution on :-(
Hope someone can guide me in the right direction..

I have this SOAP webservice, that i call:
  1. $applicationWebService = New-WebServiceProxy -uri $NAVServiceURL -Credential $NAVServiceUserCreds  -Namespace NAVPortal.Application
i can call the webservice and get data from it, it works fine, so i got a connection.

When i try to create a new entry through the create statement on the WEB service:
  1. $NewUserProfile = New-Object -TypeName NAVPortal.Application.UserPersonalizationCard
  2. $NewUserProfile.User_SID = "[USER GUID]"
  3. $NewUserProfile.User_ID = "[Domain\username]"
  4. $NewUserProfile.Profile_ID = "[ProfileID]"
  5. $applicationWebService.Create([ref]$NewUserProfile)
Then i get the following error:
  1. Exception calling "Create" with "1" argument(s): "Cannot convert the "NAVPortal.Application.UserPersonalizationCard" value of type "NAVPortal.Application.UserPersonalizatio
  2. nCard" to type "NAVPortal.Application.UserPersonalizationCard"."

What i can se from the output of the Webservice, it should be right:
  1. <?xml version="1.0"?>
  2. -<definitions xmlns:tns="urn:microsoft-dynamics-schemas/page/userpersonalizationcard" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:microsoft-dynamics-schemas/page/userpersonalizationcard">
  3.     -<types>
  4.         -<xsd:schema targetNamespace="urn:microsoft-dynamics-schemas/page/userpersonalizationcard" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
  5.             -<xsd:complexType name="UserPersonalizationCard">
  6.                 -<xsd:sequence>
  7.                     <xsd:element name="Key" type="xsd:string" maxOccurs="1" minOccurs="0"/>
  8.                     <xsd:element name="User_SID" type="xsd:string" maxOccurs="1" minOccurs="0"/>
  9.                     <xsd:element name="User_ID" type="xsd:string" maxOccurs="1" minOccurs="0"/>
  10.                     <xsd:element name="Profile_ID" type="xsd:string" maxOccurs="1" minOccurs="0"/>
  11.                     <xsd:element name="Language_ID" type="xsd:int" maxOccurs="1" minOccurs="0"/>
  12.                     <xsd:element name="Locale_ID" type="xsd:int" maxOccurs="1" minOccurs="0"/>
  13.                     <xsd:element name="Time_Zone" type="xsd:string" maxOccurs="1" minOccurs="0"/>
  14.                     <xsd:element name="Company" type="xsd:string" maxOccurs="1" minOccurs="0"/>
  15.                 </xsd:sequence>
  16.             </xsd:complexType>
  17.             +<xsd:complexType name="UserPersonalizationCard_List">
  18.             +<xsd:simpleType name="UserPersonalizationCard_Fields">
  19.             +<xsd:complexType name="UserPersonalizationCard_Filter">
  20.             +<xsd:element name="Read">
  21.             +<xsd:element name="Read_Result">
  22.             +<xsd:element name="ReadByRecId">
  23.             +<xsd:element name="ReadByRecId_Result">
  24.             +<xsd:element name="ReadMultiple">
  25.             +<xsd:element name="ReadMultiple_Result">
  26.             +<xsd:element name="IsUpdated">
  27.             +<xsd:element name="IsUpdated_Result">
  28.             +<xsd:element name="GetRecIdFromKey">
  29.             +<xsd:element name="GetRecIdFromKey_Result">
  30.             -<xsd:element name="Create">
  31.                 -<xsd:complexType>
  32.                     -<xsd:sequence>
  33.                         <xsd:element name="UserPersonalizationCard" type="tns:UserPersonalizationCard" maxOccurs="1" minOccurs="1"/>
  34.                     </xsd:sequence>
  35.                 </xsd:complexType>
  36.             </xsd:element>
  37.             +<xsd:element name="Create_Result">
I do not know if it is possible that anyone can help me without knowing more about the details in the webservice?

Thanks on advance :-)
/Graves

Re: SOAP WebServiceProxy error

Posted: Fri Apr 07, 2017 9:45 am
by jvierra
I recommend posting to the Web service provider.

Re: SOAP WebServiceProxy error

Posted: Fri Apr 07, 2017 11:52 am
by jvierra
Another suggestion. Check the service provider for C# examples of using their web service. Generally we have to use the service to create the object instance. Doing this usually prepopulates the in stance with required tokens and references. You may also need to specify the namespace of the proxy.

Re: SOAP WebServiceProxy error

Posted: Fri Apr 21, 2017 2:04 am
by Kilsgaard
Hi

Thanks for your answers.

I solved this problem by using OData instead :-)

It was easier to build the response to that in Powershell.

/Graves