Support Forums

SOAP WebServiceProxy error

Ask your Windows PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.
User avatar
Kilsgaard
Posts: 4
Joined: Fri Feb 10, 2017 3:15 am

SOAP WebServiceProxy error

Postby Kilsgaard » Fri Apr 07, 2017 3:53 am

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:
$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:
$NewUserProfile = New-Object -TypeName NAVPortal.Application.UserPersonalizationCard 
$NewUserProfile.User_SID = "[USER GUID]"
$NewUserProfile.User_ID = "[Domain\username]"
$NewUserProfile.Profile_ID = "[ProfileID]"
$applicationWebService.Create([ref]$NewUserProfile)

Then i get the following error:
Exception calling "Create" with "1" argument(s): "Cannot convert the "NAVPortal.Application.UserPersonalizationCard" value of type "NAVPortal.Application.UserPersonalizatio
nCard" to type "NAVPortal.Application.UserPersonalizationCard"."



What i can se from the output of the Webservice, it should be right:
<?xml version="1.0"?>
-<definitions xmlns:tns="urn:microsoft-dynamics-schemas/page/userpersonalizationcard" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:microsoft-dynamics-schemas/page/userpersonalizationcard">
-<types>
-<xsd:schema targetNamespace="urn:microsoft-dynamics-schemas/page/userpersonalizationcard" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
-<xsd:complexType name="UserPersonalizationCard">
-<xsd:sequence>
<xsd:element name="Key" type="xsd:string" maxOccurs="1" minOccurs="0"/>
<xsd:element name="User_SID" type="xsd:string" maxOccurs="1" minOccurs="0"/>
<xsd:element name="User_ID" type="xsd:string" maxOccurs="1" minOccurs="0"/>
<xsd:element name="Profile_ID" type="xsd:string" maxOccurs="1" minOccurs="0"/>
<xsd:element name="Language_ID" type="xsd:int" maxOccurs="1" minOccurs="0"/>
<xsd:element name="Locale_ID" type="xsd:int" maxOccurs="1" minOccurs="0"/>
<xsd:element name="Time_Zone" type="xsd:string" maxOccurs="1" minOccurs="0"/>
<xsd:element name="Company" type="xsd:string" maxOccurs="1" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
+<xsd:complexType name="UserPersonalizationCard_List">
+<xsd:simpleType name="UserPersonalizationCard_Fields">
+<xsd:complexType name="UserPersonalizationCard_Filter">
+<xsd:element name="Read">
+<xsd:element name="Read_Result">
+<xsd:element name="ReadByRecId">
+<xsd:element name="ReadByRecId_Result">
+<xsd:element name="ReadMultiple">
+<xsd:element name="ReadMultiple_Result">
+<xsd:element name="IsUpdated">
+<xsd:element name="IsUpdated_Result">
+<xsd:element name="GetRecIdFromKey">
+<xsd:element name="GetRecIdFromKey_Result">
-<xsd:element name="Create">
-<xsd:complexType>
-<xsd:sequence>
<xsd:element name="UserPersonalizationCard" type="tns:UserPersonalizationCard" maxOccurs="1" minOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
+<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
User avatar
jvierra
Posts: 10947
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: SOAP WebServiceProxy error

Postby jvierra » Fri Apr 07, 2017 9:45 am

I recommend posting to the Web service provider.
User avatar
jvierra
Posts: 10947
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: SOAP WebServiceProxy error

Postby jvierra » Fri Apr 07, 2017 11:52 am

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.
User avatar
Kilsgaard
Posts: 4
Joined: Fri Feb 10, 2017 3:15 am

Re: SOAP WebServiceProxy error

Postby Kilsgaard » Fri Apr 21, 2017 2:04 am

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

Return to “Windows PowerShell”

Who is online

Users browsing this forum: No registered users and 3 guests