Hi,
I am new to CXF and I am trying to write a service that takes some string
params for configuring the service and a File which contains content that
the service needs to process. I kept getting “No matching operation”
exception. I am probably doing this incorrectly, could someone help me see
where I got it wrong?
Here is the warning message:
======================================================================================
WARNING: .No operation matching request path /brokerInventory is found, HTTP
Method : POST, ContentType :
multipart/form-data;boundary="uuid:0aab3a08-4501-4a83-9289-dc7604728b7f";start="<broker>";start-info="text/plain";type="text/plain",
Accept : text/plain,.
======================================================================================
Here is my service interface:
======================================================================================
@Path("/brokerInventory")
public interface BrokerInventoryResource
{
static final String BROKER_PART = "broker";
static final String BROKER_FILE_TYPE_PART = "brokerFileType";
static final String INSTRUMENT_TYPE_PART = "instrumentType";
static final String INVENTORY_FILE_PART = "inventoryFile";
@POST
@Path("/")
@Produces(MediaType.TEXT_PLAIN)
@Consumes(MediaType.MULTIPART_FORM_DATA)
public String uploadBrokerInventory(@Multipart(BROKER_PART) final String
broker,
@Multipart(BROKER_FILE_TYPE_PART)
final String brokerInventoryFileType,
@Multipart(INSTRUMENT_TYPE_PART)
final String fixedIncomeInstrumentType,
@Multipart(INVENTORY_FILE_PART)
final File brokerInventoryFile);
}
======================================================================================
Here is the client that makes the request:
======================================================================================
final ContentDisposition inventoryFileDisposition = new
ContentDisposition("attachment;filename=" + file.getName());
final Attachment brokerAttachment = new
Attachment(BrokerInventoryResource.BROKER_PART, MediaType.TEXT_PLAIN,
brokerInventory.getBroker().toString());
final Attachment brokerFileTypeAttachment = new
Attachment(BrokerInventoryResource.BROKER_FILE_TYPE_PART,
MediaType.TEXT_PLAIN,
brokerInventory.getBrokerInventoryFileType().toString());
final Attachment instrumentTypeAttachment = new
Attachment(BrokerInventoryResource.INSTRUMENT_TYPE_PART,
MediaType.TEXT_PLAIN, brokerInventory.getInstType().toString());
final Attachment inventoryFileAttachment = new
Attachment(BrokerInventoryResource.INVENTORY_FILE_PART,
FileUtils.openInputStream(file), inventoryFileDisposition);
final MultipartBody multipartBody = new
MultipartBody(Arrays.asList(new Attachment[]{
brokerAttachment,
brokerFileTypeAttachment,
instrumentTypeAttachment,
inventoryFileAttachment
}));
final String statusMessage =
WebClient.create("http://localhost:8080/fixedincomesecurities/brokerInventory").
type(MediaType.MULTIPART_FORM_DATA_TYPE).
accept(MediaType.TEXT_PLAIN_TYPE).
post(multipartBody, String.class);
======================================================================================
Thanks,
Han
--
View this message in context:
http://old.nabble.com/stuck-on-multipart-tp28336934p28336934.html
Sent from the cxf-user mailing list archive at Nabble.com.