Soap request to wso2 ESB working with curl, not with python

本秂侑毒 提交于 2019-12-25 03:31:08

问题


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 command:

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

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

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'))

ESB log after python command:

[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 message

<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>

回答1:


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



来源:https://stackoverflow.com/questions/29166603/soap-request-to-wso2-esb-working-with-curl-not-with-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!