import com.chilkatsoft.*;
public class ChilkatExample {
static {
try {
System.loadLibrary("chilkat");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
CkXml xml = newCkXml();
xml.put_Tag("soapenv:Envelope");
xml.AddAttribute("xmlns:soapenv","http://schemas.xmlsoap.org/soap/envelope/");
xml.AddAttribute("xmlns:spr","http://www.springcm.com/atlas/webservices/v201308/scm/");
xml.UpdateChildContent("soapenv:Header","");
xml.UpdateChildContent("soapenv:Body|spr:GroupFind|spr:token","string");
xml.UpdateChildContent("soapenv:Body|spr:GroupFind|spr:name","string");
xml.UpdateChildContent("soapenv:Body|spr:GroupFind|spr:IncludeDeleted","true");
// In a SOAP HTTP request, including the XML declaration (<?xml version="1.0" encoding="UTF-8"?>) in the XML body is generally not required.
xml.put_EmitXmlDecl(false);
String soapRequestBody = xml.getXml();
String endpoint = "https://soapna11.springcm.com/atlas/webservices/v201308/springcmservice.asmx";
String soapAction = "http://www.springcm.com/atlas/webservices/v201308/scm/GroupFind";
// For SOAP requests, the standard Content-Type is usually set to "text/xml" or "application/soap+xml"String contentType = "text/xml";
CkHttp http = newCkHttp();
http.ClearHeaders();
http.SetRequestHeader("Content-Type",contentType);
http.SetRequestHeader("SOAPAction",soapAction);
CkHttpResponse resp = http.PostXml(endpoint,soapRequestBody,"utf-8");
if (http.get_LastMethodSuccess() == false) {
System.out.println(http.lastErrorText());
System.out.println("Failed to send SOAP request.");
return;
}
// Get the XML response body.CkXml responseXml = newCkXml();
resp.GetBodyXml(responseXml);
int statusCode = resp.get_StatusCode();
System.out.println("response status code: " + statusCode);
// If the status code does not indicate succcess, then show the response XML,
// which probably contains error information.if (statusCode != 200) {
System.out.println(responseXml.getXml());
return;
}
System.out.println(responseXml.getXml());
// Parse the successful SOAP response XML.// This is a sample of the response XML, but the namespace prefixes will be different.
// We can parse the result using "*" for the namespace prefixes (see below).String Id = responseXml.getChildContent("*:Body|*:GroupFindResponse|*:GroupFindResult|*:SCMGroup|*:Id");
String Name = responseXml.getChildContent("*:Body|*:GroupFindResponse|*:GroupFindResult|*:SCMGroup|*:Name");
String ObjectType = responseXml.getChildContent("*:Body|*:GroupFindResponse|*:GroupFindResult|*:SCMGroup|*:ObjectType");
String IsPrivate = responseXml.getChildContent("*:Body|*:GroupFindResponse|*:GroupFindResult|*:SCMGroup|*:IsPrivate");
Id = responseXml.getChildContent("*:Body|*:GroupFindResponse|*:GroupFindResult|*:SCMGroup|*:Members|*:SCMContactInfo|*:Id");
Name = responseXml.getChildContent("*:Body|*:GroupFindResponse|*:GroupFindResult|*:SCMGroup|*:Members|*:SCMContactInfo|*:Name");
ObjectType = responseXml.getChildContent("*:Body|*:GroupFindResponse|*:GroupFindResult|*:SCMGroup|*:Members|*:SCMContactInfo|*:ObjectType");
String v_Email = responseXml.getChildContent("*:Body|*:GroupFindResponse|*:GroupFindResult|*:SCMGroup|*:Members|*:SCMContactInfo|*:Email");
String FirstName = responseXml.getChildContent("*:Body|*:GroupFindResponse|*:GroupFindResult|*:SCMGroup|*:Members|*:SCMContactInfo|*:FirstName");
String LastName = responseXml.getChildContent("*:Body|*:GroupFindResponse|*:GroupFindResult|*:SCMGroup|*:Members|*:SCMContactInfo|*:LastName");
String PhoneNumber = responseXml.getChildContent("*:Body|*:GroupFindResponse|*:GroupFindResult|*:SCMGroup|*:Members|*:SCMContactInfo|*:PhoneNumber");
String FaxNumber = responseXml.getChildContent("*:Body|*:GroupFindResponse|*:GroupFindResult|*:SCMGroup|*:Members|*:SCMContactInfo|*:FaxNumber");
String Company = responseXml.getChildContent("*:Body|*:GroupFindResponse|*:GroupFindResult|*:SCMGroup|*:Members|*:SCMContactInfo|*:Company");
String Department = responseXml.getChildContent("*:Body|*:GroupFindResponse|*:GroupFindResult|*:SCMGroup|*:Members|*:SCMContactInfo|*:Department");
String Title = responseXml.getChildContent("*:Body|*:GroupFindResponse|*:GroupFindResult|*:SCMGroup|*:Members|*:SCMContactInfo|*:Title");
String Address1 = responseXml.getChildContent("*:Body|*:GroupFindResponse|*:GroupFindResult|*:SCMGroup|*:Members|*:SCMContactInfo|*:Address1");
String Address2 = responseXml.getChildContent("*:Body|*:GroupFindResponse|*:GroupFindResult|*:SCMGroup|*:Members|*:SCMContactInfo|*:Address2");
String Address3 = responseXml.getChildContent("*:Body|*:GroupFindResponse|*:GroupFindResult|*:SCMGroup|*:Members|*:SCMContactInfo|*:Address3");
String City = responseXml.getChildContent("*:Body|*:GroupFindResponse|*:GroupFindResult|*:SCMGroup|*:Members|*:SCMContactInfo|*:City");
String ProvinceState = responseXml.getChildContent("*:Body|*:GroupFindResponse|*:GroupFindResult|*:SCMGroup|*:Members|*:SCMContactInfo|*:ProvinceState");
String PostalCode = responseXml.getChildContent("*:Body|*:GroupFindResponse|*:GroupFindResult|*:SCMGroup|*:Members|*:SCMContactInfo|*:PostalCode");
String Country = responseXml.getChildContent("*:Body|*:GroupFindResponse|*:GroupFindResult|*:SCMGroup|*:Members|*:SCMContactInfo|*:Country");
String GroupType = responseXml.getChildContent("*:Body|*:GroupFindResponse|*:GroupFindResult|*:SCMGroup|*:GroupType");
}
}