我需要公开一个具有与请求名称相同的操作的SOAP WS。 通过cxf-codegen-plugin生成Java类后,我看到了此方法
#include <string>
#include <iostream>
#include <stdio.h>
using namespace std;
void swap(int *xp, int *yp)
{
int temp = *xp;
*xp = *yp;
*yp = temp;
}
void bubbleSort(int arr[], int n)
{
int i, j;
for (i = 0; i < n-1; i++)
for (j = 0; j < n-i-1; j++)
if (arr[j] > arr[j+1])
swap(&arr[j], &arr[j+1]);
}
void printArray(int arr[], int size)
{
int i;
for (i=0; i < size; i++)
printf("%d ", arr[i]);
cout<<"\n";
}
int main()
{
//Declarations
int numBoats = 5;
int boatData[5];
int costGas;
int yearsService;
int i;
int j;
int boatArray[5][3] = {{30, 100, 5000},
{20, 200, 10000},
{30, 200, 2000},
{25, 150, 12000},
{30, 50, 8000}};
//User input
cout << "Please enter the first boats cost of gas: "<<endl;
cin >> costGas;
cout << "The cost of gas you entered is " << costGas << endl;
cout << "Please enter the number of years in service: " << endl;
cin >> yearsService;
cout << "The number of years in service you entered is " << yearsService << endl;
//Calculations
for (i = 0; i < numBoats; i++) {
int mpg = boatArray[i][1];
int maintenanceCost = boatArray[i][2];
int purchaseCost = boatArray[i][3];
int totalMiles = 15000 * yearsService;
int gasTotal = totalMiles / mpg;
int maintenanceTotal = maintenanceCost * yearsService;
int operatingCost = purchaseCost + gasTotal + maintenanceTotal;
boatData[i] = operatingCost;
}
//Print operating costs
cout<<"The operating costs of each boat is: "<<endl;
printArray(boatData, numBoats);
//Bubblesort
bubbleSort(boatData, numBoats);
printArray(boatData, numBoats);
cout<<"Your lowest operating cost is "<<boatData[0]<<endl;
return 0;
}
在入站请求之后,我在Exchange-> MessageIn中看到一个具有两个项目的org.apache.cxf.message.MessageContentsList对象
1)SoapBodyRequest breq 2)SoapHeaderRequest hreq
如何设置Exchange-> Out->正文以将响应发送给客户端? 我试图通过这些方式设置Exchange-> Out-> Body
1)SoapBodyResponse 2)持有人 3)MessageContentList包含Holder,Holder 4)MessageContentList包含SoapBodyRequest,SoapHeaderRequest,Holder,Holder
但是在所有情况下,soap响应都为空:将交换主体设置为正确的正确方法是什么?