如何使用java调用基于SOAP的API假设我已经知道请求xml

时间:2016-08-03 17:00:04

标签: java xml soap

我是API调用的新手。我和我有以下几点......

  1. 我知道wsdl url
  2. 我知道我的本地系统中存储的请求xml(当我们通过SOAP UI调用API时提供的xml)
  3. 现在我如何通过java轻松调用API并捕获响应。此外,我需要在访问/调用API

    时提供凭证(我知道)

    有谁可以请我提供示例代码。

    我的XML看起来像......

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" mlns:eee="http://eee.com/">
    <soapenv:Header/>
    <soapenv:Body>
    <ehhm:createOrgUser>
    
    <!--Optional:-->
    <userData>
    <!--Optional:-->
    <userName>sharepointnew</userName>
    <!--Optional:-->
    <organizationId>609980298</organizationId>
    <!--Optional:-->
    <organizationAccountId>609980299</organizationAccountId>
    <!--Optional:-->
    <resellerId></resellerId>
    <!--Optional:-->
    <organizationAttribute>Education</organizationAttribute>
    <!--Optional:-->
    <primaryRoleName>Customer Super Admin</primaryRoleName>
    <!--Zero or more repetitions:-->
    <secondaryRoleName></secondaryRoleName>
    <!--Optional:-->
    <password>Independent12#</password>
    <!--Optional:-->
    <attributeList>
    <!--Zero or more repetitions:-->
    <attribute>
    <!--Optional:-->
    <key>FirstName</key>
    <!--Optional:-->
    <value>Morgan</value>
    </attribute>
    <attribute>
    <!--Optional:-->
    <key>LastName</key>
    <!--Optional:-->
    <value>Packards</value>
    </attribute>
    <attribute>
    <!--Optional:-->
    <key>ContactEmail</key>
    <!--Optional:-->
    <value>bmondal@ejuu.com</value>
    </attribute>
    
    </attributeList>
    <!--Optional:-->
    <storePwIn>true</storePwIn>
    </userData>
    </escm:createOrgUser>
    </soapenv:Body>
    </soapenv:Envelope>
    

    所以我需要创建连接并使用此XML调用API。

    提前感谢

0 个答案:

没有答案