HTTP500的结果来自python中的SOAP请求

时间:2016-09-23 14:37:34

标签: python soap bioinformatics

这个问题对于一个服务可能是相当具体的,但我不明白为什么我从SOAP服务获得HTTP500响应。我看到我想要访问的服务,我看到需要哪些参数。我仍然得到HTTP500。服务或我的代码有问题吗?

#!/usr/bin/env python
# Import WSDL package
from SOAPpy import WSDL

# Create service interface
wsdlUrl = 'http://bioinf.cs.ucl.ac.uk/psipred_api/wsdl'

# Download the WSDL file
server = WSDL.Proxy(wsdlUrl)

# Get the information about which services are provided by this host
print server.methods.keys()

# After selecting the service of interest let's find out which arguments are necessary
callInfo = server.methods['PsipredSubmit']
for para in callInfo.inparams:
   print para.name, para.type

# Now let's discover what we will get back
for para in callInfo.outparams:
   print para.name, para.type

sequence = "MLELLPTAVEGVSQAQITGRPEWIWLALGTALMGLGTLYFLVKGMGVSDPDAKKFYAITTLVPAIAFTMYLSMLLGYGLTMVPFGGEQNPIYWARYADWLFTTPLLLLDLALLVDADQGTILALVGADGIMIGTGLVGALTKVYSYRFVWWAISTAAMLYILYVLFFGFTSKAESMRPEVASTFKVLRNVTVVLWSAYPVVWLIGSEGAGIVPLNIETLLFMVLDVSAKVGFGLILLRSRAIFGEAEAPEPSAGDGAAATSD"
email = "psipred@cs.ucl.ac.uk"
subject = "test"

result = server.PsipredSubmit(sequence, email, subject, "True", "False", "False", "all")

print result

2 个答案:

答案 0 :(得分:1)

您的代码看起来很好,我只是尝试通过suds访问服务器,但它确实有效。

from suds.client import Client
client = Client('http://bioinf.cs.ucl.ac.uk/psipred_api/wsdl')
print('PsipredSubmit' in client.wsdl.services[0].ports[0].methods)
>>> True

您是否经常使用代理?

也许服务器暂时停机了?

sequence = "MLELLPTAVEGVSQAQITGRPEWIWLALGTALMGLGTLYFLVKGMGVSDPDAKKFYAITTLVPAIAFTMYLSMLLGYGLTMVPFGGEQNPIYWARYADWLFTTPLLLLDLALLVDADQGTILALVGADGIMIGTGLVGALTKVYSYRFVWWAISTAAMLYILYVLFFGFTSKAESMRPEVASTFKVLRNVTVVLWSAYPVVWLIGSEGAGIVPLNIETLLFMVLDVSAKVGFGLILLRSRAIFGEAEAPEPSAGDGAAATSD"
email = "psipred@cs.ucl.ac.uk"
subject = "test"
client.service.PsipredSubmit(sequence, email, subject, "True", "False", "False", "all")
>>> (reply){
>>>    message = "job submission succesful"
>>>        job_id = "2e9f0864-826a-11e6-9da3-00163e110593"
>>>    state = 1
>>>      }

提交suds作品的作品,或许您刚刚抓错了服务器或者您的SOAP库有问题?

答案 1 :(得分:0)

通常,500结果表示服务器在处理您的请求时遇到意外错误。

这可能是一个临时情况,将在一两天内得到解决:可能是服务器有一个坏的RAM芯片,或者它的磁盘已满。

或者它可能是完全故意的:也许你提交的一个值在某种程度上是不正确的,服务器基本上是在说“你搞砸了;走开了。” (在这种情况下,人们希望服务器能够响应更有用的诊断消息,但并非总是如此。)

如果您与托管组织有官方联系,或者他们是愿意帮助的好人,您可以向他们发送一条消息,询问出现了什么问题。