Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

PoSH, and WSDL\XML

$
0
0

Hi, been trying to figure out an actual question from a client, while learning at the same time, but am currently stuck.  The basic premise is that they have XML source from which they need to retrieve CustomerIDs and CustomerOrders which PoSH should dump in an array for further usage as other variables.

I found what looked to be a good article that was right up the alley of this issue, but so far haven't been able to get what I'm after by attempting to structure the script so ysimilar to:   http://blogs.technet.com/b/heyscriptingguy/archive/2009/11/18/hey-scripting-guy-november-18-2009.aspx

The u/p stuff is is bogus below of course, but the rest is workable.  The issue is that while "$i" is returning what it's supposed to, $i2 is just returning what looks to be "about" info.  I pasted what it's responding with below as well so you can see what I mean.

 

$username= "username"
$securepassword= ConvertTo-SecureString"password"-AsPlainText-Force
$CustomerScriptID='123'
$password= "password"
$cred=New-ObjectSystem.Management.Automation.PSCredential ($username,$securepassword)
$OnlineAPI= New-WebServiceProxy-Uri"https://api.securefreedom.com/vineit/webservice/onlineapi.asmx?WSDL"-Credential$cred
$ExtranetAPI= New-WebServiceProxy-Uri"https://api.securefreedom.com/vineit/webservice/extranetapi.asmx?WSDL"-Credential$cred
$t=$OnlineAPI.getType().namespace$t2=$ExtranetAPI.getType().namespace
$attributes= New-Object ($t+".Credentials")
$attributes.Username="$username"
$attributes.Password="$password"
$attributes.Token=""
$attributes2= New-Object ($t2+".Credentials")
$attributes2.Username="$username"
$attributes2.Password="$password"
$attributes2.Token=""
$CustIDs=$OnlineAPI.GetRepCustomers($attributes,123) | select-object CustomerNumber |foreach { $_.CustomerNumber }
foreach ($CustIDin$CustIDs) {
$i=$OnlineAPI.GetCustomerInfo($attributes,$CustID)
$i
$i2=$ExtranetAPI.GetCustomerOrders($attributes2,$CustID)
$i2
}
Below is the output.  The first ($i) block is correct.  The 2nd ($i2) one is where the issue is . . . .

CustomerID : 2000
FirstName : Joe
LastName : Schmo
Company :
Email : joe@schmo.com
BillStreet1 : 123 Anywhere St
BillStreet2 : Suite 200
BillCity : NYC
BillState : NY
BillPostalCode : 10101
BillCounty : KINGS
BillCountry : USA
Phone1 : 2125551212
Phone2 : 2125551212
JoinDate : 2/9/2014 11:58:05 PM
SponserRepID : 123
SponsorBCNumber : 1
CustomerType : Regular
CustStatus : Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1webservice_onlineapi_asmx_WSDL.CustomerStatus
RequestID : 0
Success : 1
Message :

RemotingFormat : Xml
SchemaSerializationMode : IncludeSchema
CaseSensitive : False
DefaultViewManager : {System.Data.DataViewManagerListItemTypeDescriptor}
EnforceConstraints : True
DataSetName : NewDataSet
Namespace :
Prefix :
ExtendedProperties : {}
HasErrors : False
IsInitialized : True
Locale : en-US
Site :
Relations : {}
Tables : {}
Container :
DesignMode : False
ContainsListCollection : True

Any pointers, ideas, input is greatly appreciated!

Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>