1

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: "user@mail.com",
  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>user@mail.com</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

j08691
  • 204,283
  • 31
  • 260
  • 272

2 Answers2

1

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>user@mail.com</email>
      <firstName>First</firstName>
      <lastName>Last</lastName>
      <officePhone>1234-1234</officePhone>
      <postalCode>11011</postalCode>
      <state>NY</state>
    </account>
  </templateObject>
    </createObject>
  </env:Body>
</env:Envelope>
Chris Gallo
  • 191
  • 1
  • 4
  • Seems SoftLayer WSDL is rpc/encoded (as far as I researched), and the library I was using to support SOAP operation only supports Document/literal, I added support to rpc/encoded and now things are running fine. thank you! – Celso Fernandes Mar 03 '16 at 17:06
0

Some properties were added in createObject:

  • acknowledgementRequiredFlag and
  • policyId

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">user@testmail.com</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.

mcruz
  • 1,534
  • 2
  • 11
  • 14
  • hi mcruz, sadly it didn't work, sending exactly your xml (with my data) API returned bad request. any further suggestion? thank you – Celso Fernandes Mar 02 '16 at 02:35
  • in my request I just added `xsi:type="v3:SoftLayer_Brand"` type on template object and received a bad request too – Celso Fernandes Mar 02 '16 at 14:49
  • It seems strange. I executed again the SOAP request and it works well. Currently I'm using SOAP UI, the unique difference between your Client's request and the request I sent is, that all properties listed have "xsi:type" (i.e. my case: FirstName, client's case:First). Please try the client's request again adding only this section "supportPolicyAssignment" (with "acknowledgementRequiredFlag" and "policyId") avoiding "xsi:type". – mcruz Mar 02 '16 at 15:30
  • hi mcruz, I tried, no success... I sent in the exactly order you shown you SOAP request worked? mine requests (without xsi:type) I use to create dns entries, under SoftLayer_Dns_Domain... I never had a problem with the type – Celso Fernandes Mar 02 '16 at 15:55
  • It works using my environment. I don't know how help you. Sorry. If I have any news I will tell you. You could open a SL ticket in order the devs can see this case. My apologies. – mcruz Mar 02 '16 at 19:40
  • I did, the support agent told me to post on stack overflow... thank you very much mcruz – Celso Fernandes Mar 02 '16 at 20:23