Lead creation via SOAP is buggy | Community
Skip to main content
July 15, 2014
Solved

Lead creation via SOAP is buggy

  • July 15, 2014
  • 12 replies
  • 2798 views
After much investigation this afternoon, I'm convinced that the system has crucial bugs with regard to Leads created via SOAP.
 
When I create a Lead with the UI, I can do all of the following via SOAP:
  • getLead
  • syncLead to alter attributes, see changes in web UI
  • add the lead to an existing list

When I create a Lead with SOAP, I see different results:
  • can't see it in the web UI
  • getLead is ok
  • syncLead to alter attributes is ok
  • can't add the lead to an existing list (no reason given in response)

It seems that a SOAP-created Lead is only half-recognized by the system.  I can create it and modify it on the back-end, but the front-end is oblivious.
 
I'd assume anyone using SOAP will need to create Leads, so I think this is a significant bug.
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by
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>

12 replies

Amy_Lepre
Level 6
July 16, 2014
Have you created a ticket with support? We are creating leads via the SOAP API and are not experiencing the same issues.
July 16, 2014
I have.
July 16, 2014
This is the message that I sent.  Maybe you can see an error in it?

The response was status=CREATED, but the Lead does not show up in the web UI.

<?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-16T11:16:28-05:00</requestTimestamp>

    </ns1:AuthenticationHeader>

  </SOAP-ENV:Header>

  <SOAP-ENV:Body>

    <tns:paramsSyncLead>

      <returnLead>true</returnLead>

      <leadRecord>

        <leadAttributeList>

          <attribute>

            <attrName>FirstName</attrName>

            <attrValue>Fake</attrValue>

            <attrType>string</attrType>

          </attribute>

          <attribute>

            <attrName>LastName</attrName>

            <attrValue>Guy</attrValue>

            <attrType>string</attrType>

          </attribute>

        </leadAttributeList>

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

      </leadRecord>

    </tns:paramsSyncLead>

  </SOAP-ENV:Body>

</SOAP-ENV:Envelope>

Kenny_Elkington
Adobe Employee
Adobe Employee
July 16, 2014
Hi Grant,

There are several issues with the formatting of your particular SyncLead call.
  • Email is expected prrior to the leadAttributeList
  • in your attributes, attrType must come before attrValue or not at all
  • returnLead needs to be passed after leadAttributeList

July 16, 2014
Kenny, I implemented your suggestions, but I'm still seeing the same result.  My new lead is still not appearing in the web UI.

Here's the updated request.  This matches your suggestions, right?

<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-16T13:39:41-05:00</requestTimestamp>

    </ns1:AuthenticationHeader>

  </SOAP-ENV:Header>

  <SOAP-ENV:Body>

    <tns:paramsSyncLead>

      <leadRecord>

        <email>clarkkent@example.com</email>

        <leadAttributeList>

          <attribute>

            <attrName>FirstName</attrName>

            <attrType>string</attrType>

            <attrValue>Clark</attrValue>

          </attribute>

          <attribute>

            <attrName>LastName</attrName>

            <attrType>string</attrType>

            <attrValue>Kent</attrValue>

          </attribute>

        </leadAttributeList>

      </leadRecord>

      <returnLead>true</returnLead>

    </tns:paramsSyncLead>

  </SOAP-ENV:Body>

</SOAP-ENV:Envelope>





Kenny_Elkington
Adobe Employee
Adobe Employee
July 16, 2014
Hi Grant,

The <Email> element is case sensitive.  The lack of capitalization is the likely culprit.
July 17, 2014
Kenny,

I uppercased my "Email" element.  Now my returned lead looks more correct, but I still do not see this Lead in my UI.
Kenny_Elkington
Adobe Employee
Adobe Employee
July 17, 2014
How are you searching for this particular lead in the UI?  Are you searching via email address in the Lead Database?
July 17, 2014
I had a support call with Troy; he figured out the problem.

1) My UI login is restricted to a workspace.  I did not know this.  There is no way (that I can find) for me to see if I am locked to a workspace or what workspace that is.

Marketo Problem 1: Users need to be able to see their workspace restrictions.

2) My SOAP credentials are not restricted to a workspace, so it was writing my Leads to the "default" workspace, which my UI can't see.

I need to make my SOAP write Leads to the correct workspace.  The docs say I can do this by setting a Context Header.  Howerver, the docs don't actually tell me what the XML for a Context Header looks like.  That's kind of a botch-up, isn't it?

Marketo Problem 2: Docs need to show what a Context Header looks like in XML.

Troy is going to get back to me on the Context Header format.  When I get it, I will report back here and mark it answered.
Kenny_Elkington
Adobe Employee
Adobe Employee
July 17, 2014
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.