FuelSDK-Java
FuelSDK-Java copied to clipboard
Initializing ETClient for REST connection requires CXF
I think the following code should do the trick:
public ETSoapConnection getSoapConnection() throws ETSdkException{
if (soapConnection == null) {
if (soapEndpoint == null) {
String response = restConnection.get(PATH_ENDPOINTS_SOAP);
JsonParser jsonParser = new JsonParser();
JsonObject jsonObject = jsonParser.parse(response).getAsJsonObject();
soapEndpoint = jsonObject.get("url").getAsString();
logger.debug("SOAP endpoint: " + soapEndpoint);
}
soapConnection = new ETSoapConnection(this, soapEndpoint);
}
return soapConnection;
}
I'm not sure I'm following--are you suggesting it should be possible to initialize the client library such that CXF isn't required when you're using it purely for REST? -ian
Why is the CXF dependency not listed in the README as one of the required dependencies for the SDK jar to run? I am looking for a way to bring in the necessary dependencies while still keeping the dependency profile small, because I am running into problems with the jetty and spring dependencies of CXF when I allow all of fuel-java transitive dependencies to be brought in.
I'm adding this as an enhancement for v1.2: In v1.2, CXF will be optional--the SDK will read and write SOAP envelopes natively. -ian
In the meantime I have added the CXF dependency to the README. -ian
Yes, I only needed REST, so I altered the code to support only one at a time.
Please consider providing two different artifacts for using either REST or SOAP in future. The SOAP client is really very clumsy and pulls in gigabytes of dependencies.