SOLVED

Re: Lead creation via SOAP is buggy

Go to solution
Kenny_Elkington
Marketo Employee

Re: Lead creation via SOAP is buggy

Hey Grant,

The mktowsContextHeader defined in the WSDL, but you're correct it does not have an XML example on the developers site.  I've asked our docs team to address this shortcoming.

Here's an example of what an mktowsContextHeader looks like:

      <mkt:MktowsContextHeader>
         <targetWorkspace>?</targetWorkspace>
      </mkt:MktowsContextHeader>

As far as which workspace restrictions are in place for your own user account, you can see workspaces which you can acess from the UI in Marketing Activities.  The workspaces shown in the nav tree ae the ones available to you.  Beyond that, you may want to take this particular issue over to the ideas section, as it does not seem very intuitive for non-admin users to identify their workspace access.
Anonymous
Not applicable

Re: Lead creation via SOAP is buggy

Kenny, I don't think my privileges are enough to see my workspace.  See screenshot.  As you can see, my Nav tree is pretty empty.
http://i.imgur.com/Xm7R3L4.png

I should have checked the WSDL.  Sorry, I'm a bit of a SOAP noob.  Thanks for your help.
Anonymous
Not applicable

Re: Lead creation via SOAP is buggy

Got it.  Finally.  Thanks for the help, Kenny.

Here is the correct form of the request, with workspace.  (Note: from the WSDL, it appears that only syncLead supports the ContextHeader.)

 <?xml version="1.0" encoding="UTF-8"?>

<SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://www.marketo.com/mktows/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.marketo.com/mktows/">

  <SOAP-ENV:Header>

    <ns1:AuthenticationHeader>

      <mktowsUserId>OMITTED</mktowsUserId>

      <requestSignature>OMITTED</requestSignature>

      <requestTimestamp>2014-07-17T17:01:53-05:00</requestTimestamp>

    </ns1:AuthenticationHeader>

    <ns1:MktowsContextHeader>

      <targetWorkspace>NAME OF MY WORKSPACE</targetWorkspace>

    </ns1:MktowsContextHeader>

  </SOAP-ENV:Header>

  <SOAP-ENV:Body>

    <tns:paramsSyncLead>

      <leadRecord>

        <Email>starlord@example.com</Email>

        <leadAttributeList>

          <attribute>

            <attrName>FirstName</attrName>

            <attrType>string</attrType>

            <attrValue>Peter</attrValue>

          </attribute>

          <attribute>

            <attrName>LastName</attrName>

            <attrType>string</attrType>

            <attrValue>Quill</attrValue>

          </attribute>

        </leadAttributeList>

      </leadRecord>

      <returnLead>true</returnLead>

    </tns:paramsSyncLead>

  </SOAP-ENV:Body>

</SOAP-ENV:Envelope>