Trouble Accessing API

38 views
Skip to first unread message

Cory Li

unread,
Aug 23, 2013, 3:15:16 AM8/23/13
to gd-...@googlegroups.com
Hello,

I'm having a significant amount of trouble accessing the public registry via the SOAP API.  The provided python example doesn't seem to work correctly, and the signatures in the latest source seem to different from what the WSDL seems to indicate.

The first issue is that the server seems to want to set the response type to "multipart/related" instead of "text/xml" which seems to break all known python SOAP libraries including both ZSI and SUDS. So I tried crafting responses by hand, but I still seem to be running into issues.

The two calls that I can actually get to work are "Login" and "getPublicPart".  For instance, sending a "getPublicPart" request:

<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ZSI="http://www.zolera.com/schemas/ZSI/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Header></SOAP-ENV:Header>
<SOAP-ENV:Body xmlns:ns1="https://api.registry.jbei.org/">
<ns1:getPublicPart>
<entryId>262</entryId>
</ns1:getPublicPart>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


correctly gives me back (note the extra headers too):

--uuid:33e81da0-c18a-48b8-b0f6-dca973e547bd
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml";
Content-Transfer-Encoding: binary
Content-ID: <root.message@cxf.apache.org>

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:getPublicPartResponse xmlns:ns2="https://api.registry.jbei.org/"><return xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:plasmidData"><bioSafetyLevel>1</bioSafetyLevel><canEdit>false</canEdit><creationTime>1299811524000</creationTime><creator>Will Holtz</creator><creatorEmail>holtz@berkeley.edu</creatorEmail><creatorId>0</creatorId><fundingSource>SynBERC</fundingSource><hasAttachment>false</hasAttachment><hasOriginalSequence>true</hasOriginalSequence><hasSample>false</hasSample><hasSequence>true</hasSequence><id>262</id><intellectualProperty>Open</intellectualProperty><links></links><longDescription>constitutive RFP cassette between BglBrick sites for easy identification of background colonies</longDescription><modificationTime>1314658879492</modificationTime><name>pBbS0k-RFP</name><owner>William Holtz</owner><ownerEmail>wholtz@gmail.com</ownerEmail><ownerId>117</ownerId><partId>JPUB_000262</partId><principalInvestigator>Jay Keasling</principalInvestigator><publicRead>false</publicRead><recordId>b0bde4c5-d2f4-47b6-a43a-bfc11d63ce08</recordId><selectionMarkers>Kanamycin</selectionMarkers><shortDescription>BglBrick vector based on the work of Rachel Krupa w/constitutive RFP cassette</shortDescription><status>complete</status><type>PLASMID</type><visibility>OK</visibility><circular>true</circular><originOfReplication>SC101**</originOfReplication></return></ns2:getPublicPartResponse></soap:Body></soap:Envelope>


But if we use the same entry ID to request the sequence via "getPublicSequence", the server returns back a completely empty response, despite the earlier XML indicating that hasSequence = true:

--uuid:0b534d12-0dfb-46c3-aa32-fa5a74476116
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml";
Content-Transfer-Encoding: binary
Content-ID: <root.m...@cxf.apache.org>

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:getPublicSequenceResponse xmlns:ns2="https://api.registry.jbei.org/"/>
</soap:Body>
</soap:Envelope> --uuid:0b534d12-0dfb-46c3-aa32-fa5a74476116--


Outside of those two calls, using any API call that requires a valid sessionId (such as "getSequence") just gives me back a "Registry Service Internal Error":
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body><soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Registry Service Internal Error!</faultstring>
<detail>
<ns1:ServiceException xmlns:ns1="https://api.registry.jbei.org/"/></detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>

despite having a valid token.  If I pass an invalid token, it correctly tells me to authenticate first, so that at least seems to be working correctly.
Any assistance or insight into what I'm doing wrong would be greatly appreciated.

Cheers,
Cory


Hector Plahar

unread,
Aug 23, 2013, 3:36:24 PM8/23/13
to gd-...@googlegroups.com
Hi, Cory,

I just release version 3.4 of ICE and I have yet to update the provided examples. I hope to do that soon.

In terms of the response type, it is likely because I am now using MTOM to transfer the binary data associated with parts. I will investigate it further when I update the examples.
The API is not doing a good job in reporting information about the issues it encountered in fulfilling the request, but the internal logs point to an invalid entry id. What are the specific parameters you used when making the call?

Hector Plahar

unread,
Aug 23, 2013, 4:51:31 PM8/23/13
to gd-...@googlegroups.com
Also, I should have mentioned that when the parameter identifier for a part is a string, then it is expecting the recordId. In your example it is b0bde4c5-d2f4-47b6-a43a-bfc11d63ce08

Cory Li

unread,
Aug 23, 2013, 7:07:07 PM8/23/13
to gd-...@googlegroups.com
Ah ok. Thanks a ton for that info -- got it to work.  So the parameter name "entryId" is actually a recordId instead.  That was pretty confusing.

I managed to finally craft the correct XML responses required by hand, and then parse the resulting multipart/related response via python's email.message parser.  Quite a bit of work, and seems rather fragile.  Will any change of response type hopefully be announced? (eg: away from MTOM)

p.s. There aren't any plans for a slightly easier REST API, are there?

~Cory

Hector Plahar

unread,
Aug 29, 2013, 12:38:26 PM8/29/13
to gd-...@googlegroups.com
The API is going to be a major area of focus in an upcoming release so hopefully I can address many of these issues. 


--
 
---
You received this message because you are subscribed to the Google Groups "gd-ice" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gd-ice+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages