locked
Execute SOAP call in powershell RRS feed

  • Question

  • I have tried the following code:

    [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
    [System.Net.ServicePointManager]::Expect100Continue = $false
    
    $URI = "https://server/soap/wsdl/"
    
    $ib = New-WebServiceProxy -Uri $URI -Namespace WebServiceProxy 
    
    $sessionId = $ib.login("userName","passWord")
    
    $test = New-Object WebServiceProxy.input_logixNcnmCreation
    
    $aaa = New-Object ("WebServiceProxy.input_logixNcnmCreation")
    $aaa.test.value = "aaa"
    $aaa.type = "Input"
    $aaa.value = " "
    $aaa | gm
    $ib.invokeAsynclogixNcnmCreation($sessionId, $aaa)
    
    $sessionId

    code but all I get is 

    Cannot convert argument "1", with value: "WebServiceProxy.input_logixNcnmCreation", for "invokeAsynclogixNcnmCreation" to type "WebServiceProxy.input_logixNcnmCreation": "Cannot convert the "
    WebServiceProxy.input_logixNcnmCreation" value of type "WebServiceProxy.input_logixNcnmCreation" to type "WebServiceProxy.input_logixNcnmCreation"."
    At location.ps1:23 char:37

    Any ideas on what I may be missing?

    Tuesday, August 1, 2017 7:14 PM

All replies

  • Why are you doing this twice?

    $test = New-Object WebServiceProxy.input_logixNcnmCreation

    $aaa
    = New-Object ("WebServiceProxy.input_logixNcnmCreation")

    We do not need quotes or parens with this.


    \_(ツ)_/

    Tuesday, August 1, 2017 7:24 PM
  • Meant to comment the second one out. Trying different ways but neither worked.
    Tuesday, August 1, 2017 7:30 PM
  • Try this:

    [WebServiceProxy.input_logixNcnmCreation]

    If that does not return a class object then you need to ask the web api owner for instructions on how to instantiate an object.


    You should only need to declare "namespace" when avoiding collisions.

    $proxy = New-WebServiceProxy -Uri$URI



    \_(ツ)_/


    • Edited by jrv Tuesday, August 1, 2017 7:38 PM
    Tuesday, August 1, 2017 7:37 PM
  • It tells me to "make sure that the assembly containing this type is loaded.". I am attempting to call integration builder and pass a parameter but it seems to lack any sort of documentation.
    Tuesday, August 1, 2017 7:41 PM
  • Now I get:

    Cannot convert argument "1", with value: "Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy74ttps___10_100_1_219_soap_wsdl_.input_LogixNcnmCreation", for "invokeAsyn
    cLogixNcnmCreation" to type "Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy74ttps___10_100_1_219_soap_wsdl_.input_LogixNcnmCreation": "Cannot convert the "Mic
    rosoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy74ttps___10_100_1_219_soap_wsdl_.input_LogixNcnmCreation" value of type "Microsoft.PowerShell.Commands.NewWebservicePro
    xy.AutogeneratedTypes.WebServiceProxy74ttps___10_100_1_219_soap_wsdl_.input_LogixNcnmCreation" to type "Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy74ttps___10_
    100_1_219_soap_wsdl_.input_LogixNcnmCreation"."

    Tuesday, August 1, 2017 7:43 PM
  • We cannot help you with APIs.  You must find a forum for the API or contact the vendor or author of the API.


    \_(ツ)_/

    Tuesday, August 1, 2017 7:45 PM
  • I have tried but they lack that, I was hoping maybe to be pointed in the direction of the error and a possible resolution.
    Tuesday, August 1, 2017 7:46 PM
  • If the vendor won't help you then you are out of luck.  Without documentation and examples there is no way to determine what your issue is.

    The class you are trying to use clearly does not exist.


    \_(ツ)_/

    Tuesday, August 1, 2017 7:47 PM
  • Hi Chuck_1987,

    Just checking in to see if the information provided was helpful.

    Please let us know if you would like further assistance.

    Best Regards,

    Candy


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Wednesday, August 30, 2017 8:44 AM