- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java client throws IOException for 201 responses due to missing body #136
Comments
Indeed, Kill Bill doesn't return the body upon creation (https://docs.killbill.io/latest/quick_start_with_kb_api#_step_3_create_an_account), but you can ask the client to fetch it automatically using killbill-client-java/src/main/java/org/killbill/billing/client/KillBillHttpClient.java Line 336 in 910bcdc
IIRC we could never really tell Swagger about this behaviour. |
I have tried that, and still get an IOException: RequestOptions.builder
.withCreatedBy("CS2")
.withFollowLocation(Boolean.TRUE)
.build() Looking at the code for |
Are you following https://docs.killbill.io/latest/java_client ? If so, could you share a |
I am using the latest version in Maven Central, 1.3.6. I have coded a test in Java, and still get an IOException: package org.example;
import org.killbill.billing.catalog.api.Currency;
import org.killbill.billing.client.*;
import org.killbill.billing.client.api.gen.*;
import org.killbill.billing.client.model.gen.Account;
public class Main {
static KillBillHttpClient client = new KillBillHttpClient(REDACTED);
static AccountApi accountApi = new AccountApi(client);
public static void main(String[] args) {
var requestOptions = RequestOptions.builder()
.withCreatedBy("CS2")
.withFollowLocation(Boolean.TRUE)
.build();
var body = new Account();
body.setName("test");
body.setCurrency(Currency.USD);
body.setExternalKey("xyzzy2");
body.setEmail("test@comcast.com");
try {
var result = accountApi.createAccount(body, requestOptions);
System.out.println(result);
} catch (KillBillClientException e) {
e.printStackTrace();
}
}
} |
Unable to reproduce.
pom.xml:
App.java:
Execution:
Java version:
|
Using the debugger, I can see that the location URL is using http, the request to killbill is using https: static KillBillHttpClient client = new KillBillHttpClient(
"https://killbill.dev.commerce.comcast.com",
We are self-hosting KB in AWS, and I am testing from my laptop. |
Is the Related: |
This results in an IOException, as there is no response body. Running the code again results in a 409 exception,
Account already exists for key 89f20977-f937-4bd7-82f9-ac4ef07b9999
, indicating the account was successful created.When creating similar accounts in the swagger page, I see the response code is 201, but the server does not return a body. The swagger page suggests that an Account object will be returned. This conflicts with the information in the docs, which says that the endpoint will return a URL in the
location
header.The text was updated successfully, but these errors were encountered: