Reputation: 83
I'm trying to create a Sub brand (using a self written SOAP client).
on wsdl SoftLayer_Brand#createObject asked for a parameter templateObject
that is a tns:SoftLayer_Brand
Checking this complex type on xsd file I got the file type and I'm passing the following hash to request
longName: "Company Long Name",
name: "Company Name",
keyName: "KEY_NAME",
account: {
address1: "123 5th Street",
city: "City",
companyName: "Company Name",
country: "US",
email: "[email protected]",
firstName: "First",
lastName: "Last",
officePhone: '1234-1234',
postalCode: "11011",
state: "NY"
}
My client is sending the request using the following XML
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://api.service.softlayer.com/soap/v3/" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header>
<authenticate>
<username>SL00000</username>
<apiKey>apikeyhash</apiKey>
</authenticate>
</env:Header>
<env:Body>
<tns:createObject>
<templateObject>
<longName>Company Long Name</longName>
<name>Company Name</name>
<keyName>KEY_NAME</keyName>
<account>
<address1>123 5th Street</address1>
<city>City</city>
<companyName>Company Name - Master Account</companyName>
<country>US</country>
<email>[email protected]</email>
<firstName>First</firstName>
<lastName>Last</lastName>
<officePhone>1234-1234</officePhone>
<postalCode>11011</postalCode>
<state>NY</state>
</account>
</templateObject>
</tns:createObject>
</env:Body>
</env:Envelope>
I've created Sub Brands before, but it's not working anymore, could you please point me if any parameter is missing.
On fog-softlayer we create this way https://github.com/fog/fog-softlayer/blob/master/examples/account.md#create-a-connection-to-softlayer-account-service (disclaimer: I'm one of fog softlayer maintainers)
Tried with parameters as shown on this (old) gist https://gist.github.com/underscorephil/377bd50e71ac02377008 and didn't work too.
Just would like to know if something changed or any validation is being applied to parameters.
Thank you
Upvotes: 1
Views: 155
Reputation: 191
Ok, I think I got this figured out.
1: you are using the v3 version of the api, and while this USUALLY isn't an issue, you need to use v3.1 here.
2: In your header, you are including the SL SOAP definitions with xmlns:tns="", so you need to be using xsi:type="tns:SoftLayer_Brand" Or you could use xmlns:v3="http://api.service.softlayer.com/soap/v3.1/" and xsi:type="v3:SoftLayer_Brand"
This call worked
curl -d @createBrand.soap.xml https://api.softlayer.com/soap/v3.1/SoftLayer_Brand
createBrand.soap.xml
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://api.service.softlayer.com/soap/v3.1/" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header>
<authenticate>
<username>SL1234</username>
<apiKey>kkeeyy</apiKey>
</authenticate>
</env:Header>
<env:Body>
<createObject >
<templateObject xsi:type="tns:SoftLayer_Brand">
<longName>Company Long Name</longName>
<name>Company Name</name>
<keyName>KEY_NAME</keyName>
<account>
<address1>123 5th Street</address1>
<city>City</city>
<companyName>Company Name - Master Account</companyName>
<country>US</country>
<email>[email protected]</email>
<firstName>First</firstName>
<lastName>Last</lastName>
<officePhone>1234-1234</officePhone>
<postalCode>11011</postalCode>
<state>NY</state>
</account>
</templateObject>
</createObject>
</env:Body>
</env:Envelope>
Upvotes: 1
Reputation: 1532
Some properties were added in createObject
:
Where:
When acknowledgementRequiredFlag
is enabled and a new policy is added, then this policy will be shown when the user login to the portal (User is required to see the Support Policy). Otherwise, this option can be disabled (User is NOT required to see the Support Policy).
policyId
has two policy types:
”SoftLayer Indirect Support Policy” with id = 101
and SoftLayer Standard Support Policy with id=1
(I didn't find information related to these options).
Below is a SOAP example:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v3="http://api.service.softlayer.com/soap/v3/">
<soapenv:Header>
<SoftLayer_BrandObjectMask xsi:type="v3:SoftLayer_BrandObjectMask">
<mask xsi:type="v3:SoftLayer_Brand"/>
</SoftLayer_BrandObjectMask>
<authenticate xsi:type="v3:authenticate">
<username xsi:type="xsd:string">?</username>
<apiKey xsi:type="xsd:string">?</apiKey>
</authenticate>
</soapenv:Header>
<soapenv:Body>
<v3:createObject soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<templateObject xsi:type="v3:SoftLayer_Brand">
<keyName xsi:type="xsd:string">KEY_NAME</keyName>
<longName xsi:type="xsd:string">Company Long Name</longName>
<name xsi:type="xsd:string">Company Name</name>
<account xsi:type="ns1:SoftLayer_Account">
<address1 xsi:type="xsd:string">123 5th Street</address1>
<city xsi:type="xsd:string">Dallas</city>
<companyName xsi:type="xsd:string">test Company Name</companyName>
<country xsi:type="xsd:string">US</country>
<email xsi:type="xsd:string">[email protected]</email>
<firstName xsi:type="xsd:string">FirstName</firstName>
<lastName xsi:type="xsd:string">LastName</lastName>
<officePhone xsi:type="xsd:string">591789611111</officePhone>
<postalCode xsi:type="xsd:string">32124</postalCode>
<state xsi:type="xsd:string">NY</state>
</account>
<supportPolicyAssignment xsi:type="ns1:SoftLayer_Policy_Brand">
<acknowledgementRequiredFlag xsi:type="xsd:int">1</acknowledgementRequiredFlag>
<policyId xsi:type="xsd:int">101</policyId>
</supportPolicyAssignment>
</templateObject>
</v3:createObject>
</soapenv:Body>
</soapenv:Envelope>
I hope it help you.
Upvotes: 0