肥皂请求wso2 ESB工作与curl,而不是与python [英] Soap request to wso2 ESB working with curl, not with python

查看:270
本文介绍了肥皂请求wso2 ESB工作与curl,而不是与python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪的问题。当我通过使用curl发送soap请求来添加ESB连接器时,将成功添加连接器。当我使用python发送相同的消息,我得到这个奇怪的错误。

I'm having a strange problem. When I add an ESB connector by sending a soap request using curl, the connector is added successfully. When I send the same message using python, I get this weird error. What am I missing?

Curl命令:

curl --basic -u admin:admin -H "Content-Type: application/soap+xml" -k -d @request.xml https://localhost:9443/services/MediationLibraryAdminService.MediationLibraryAdminServiceHttpsSoap12Endpoint

ESB log curl命令后:

ESB log after curl command:

[2015-03-20 06:09:05,154]  INFO - CarbonAuthenticationUtil 'admin@carbon.super [-1234]' logged in at [2015-03-20 06:09:05,154-0600]
[2015-03-20 06:09:05,156]  INFO - SynapseImportFactory Successfully created Synapse Import: kafka

这是python代码:

This is the python code:

   SoapMessage = SOAP_MESSAGE.encode('utf-8')
    url = 'https://localhost:9443/services/MediationLibraryAdminService.MediationLibraryAdminServiceHttpsSoap12Endpoint'
    headers = {'content-type': 'application/soap+xml; charset=UTF-8',
            "Content-Length": len(SoapMessage),
            "SOAPAction": url}
    r = requests.post(url, data=SoapMessage, headers=headers, verify=False, auth=HTTPBasicAuth('admin', 'admin'))

python命令:

[2015-03-20 06:27:59,346]  INFO - CarbonAuthenticationUtil 'admin@carbon.super [-1234]' logged in at [2015-03-20 06:27:59,345-0600]
[2015-03-20 06:28:08,317]  INFO - LibraryArtifactDeployer Synapse Library named '{org.wso2.carbon.connector}kafka' has been deployed from file : /opt/$
[2015-03-20 06:28:08,318] ERROR - MediatorFactoryFinder Unknown mediator referenced by configuration element : {http://ws.apache.org/ns/synapse}kafka
[2015-03-20 06:28:08,318]  WARN - ProxyServiceDeployer Proxy service hot deployment from file: /opt/wso2esb/wso2esb-4.8.0/repository/deployment/server$
org.apache.synapse.SynapseException: Unknown mediator referenced by configuration element : {http://ws.apache.org/ns/synapse}kafka
        at org.apache.synapse.config.xml.MediatorFactoryFinder.getMediator(MediatorFactoryFinder.java:218)
        at org.apache.synapse.config.xml.AbstractListMediatorFactory.addChildren(AbstractListMediatorFactory.java:41)
        at org.apache.synapse.config.xml.SequenceMediatorFactory.createAnonymousSequence(SequenceMediatorFactory.java:70)
        at org.apache.synapse.config.xml.ProxyServiceFactory.createProxy(ProxyServiceFactory.java:178)
        at org.apache.synapse.deployers.ProxyServiceDeployer.deploySynapseArtifact(ProxyServiceDeployer.java:58)
        at org.wso2.carbon.proxyadmin.ProxyServiceDeployer.deploySynapseArtifact(ProxyServiceDeployer.java:46)
        at org.apache.synapse.deployers.AbstractSynapseArtifactDeployer.deploy(AbstractSynapseArtifactDeployer.java:190)
        at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)
        at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:807)
        at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144)
        at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:377)
        at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:254)
        at org.apache.axis2.deployment.RepositoryListener.startListener(RepositoryListener.java:371)
        at org.apache.axis2.deployment.scheduler.SchedulerTask.checkRepository(SchedulerTask.java:59)
        at org.apache.axis2.deployment.scheduler.SchedulerTask.run(SchedulerTask.java:67)
        at org.wso2.carbon.core.deployment.CarbonDeploymentSchedulerTask.runAxisDeployment(CarbonDeploymentSchedulerTask.java:79)
        at org.wso2.carbon.core.deployment.CarbonDeploymentSchedulerTask.run(CarbonDeploymentSchedulerTask.java:124)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:165)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:701)

soap讯息

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://org.apache.synapse/xsd">
<soap:Header/>
<soap:Body>
        <xsd:updateStatus>
                <xsd:libQName>{org.wso2.carbon.connector}kafka</xsd:libQName>
                <xsd:libName>kafka</xsd:libName>
                <xsd:packageName>org.wso2.carbon.connector</xsd:packageName>
                <xsd:status>enabled</xsd:status>
        </xsd:updateStatus>
</soap:Body>


推荐答案

所以问题是, code>< / soap:Body> 。这导致服务崩溃。删除enter解决了问题。

So the problem was that I put an enter after </soap:Body>. This caused the service to crash. Removing the enter fixed the problem.

这篇关于肥皂请求wso2 ESB工作与curl,而不是与python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆