我有一个生成请求的WCF SOAP客户端.这被服务器拒绝为无效请求.我已经使用SOAPUI将其追溯到命名空间,但无法弄清楚如何让客户端生成所需的结果.
客户端是从wsdl生成的Web服务引用,并生成以下SOAP消息;
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header></s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<createShipmentRequest xmlns="http://www.royalmailgroup.com/api/ship/V2">
<integrationHeader>
<dateTime xmlns="http://www.royalmailgroup.com/integration/core/V1">2015-07-23</dateTime>
<version xmlns="http://www.royalmailgroup.com/integration/core/V1">2</version>
<identification xmlns="http://www.royalmailgroup.com/integration/core/V1">
<applicationId>some random number</applicationId>
<transactionId>some reference number</transactionId>
</identification>
</integrationHeader>
</createShipmentRequest>
</s:Body>
</s:Envelope>
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,名称空间正在各个元素上输出......
我的工作示例在SOAP Envelope中定义了名称空间;
<s:Envelope xmlns:v2="http://www.royalmailgroup.com/api/ship/V2" xmlns:v1="http://www.royalmailgroup.com/integration/core/V1" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header></s:Header>
<s:Body>
<v2:createShipmentRequest>
<v2:integrationHeader>
<v1:dateTime>2015-07-23</v1:dateTime>
<v1:version>2</v1:version>
<v1:identification>
<v1:applicationId>some random number</v1:applicationId>
<v1:transactionId>some reference number</v1:transactionId>
</v1:identification>
</v2:integrationHeader>
</v2:createShipmentRequest>
</s:Body>
</s:Envelope>
Run Code Online (Sandbox Code Playgroud)
根据我的理解,这不应该有所作为,但服务器只是拒绝请求.在SOAPUI中修改我生成的请求之后,它肯定会导致问题,那么我如何将两个命名空间定义v1和v2移动到SOAP Envelope,然后让正确的元素使用正确的前缀?
我的客户端使用以下功能启动;
private shippingAPIPortTypeClient GetProxy() {
BasicHttpBinding myBinding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
shippingClient = new shippingAPIPortTypeClient(myBinding, new EndpointAddress(new Uri(shippingClientSandboxEndpoint), EndpointIdentity.CreateDnsIdentity("api.royalmail.com"), new AddressHeaderCollection())); …Run Code Online (Sandbox Code Playgroud) 我有一个tableview,它有一个可观察的自定义类对象列表(类类型:SalesInvoiceNetSale).表中的数据都很好.可观察列表中的最后一项是总计行(类类型:SalesInvoiceNetSaleTotal,它扩展了SalesInvoiceNetSale类).如果用户尝试按列对表进行排序,我只希望让我的表不对数组中的最后一条记录进行排序.我发现另一个帖子几乎都在询问如何做同样的事情,但似乎无法解决这个问题,我怀疑这是我对Java 8的Lambda表达式的不了解.TableView从排序中排除底行(总计)
public ObservableList<SalesInvoiceNetSale> applyTableTotalsToSalesInvoiceNetSaleList(ObservableList<SalesInvoiceNetSale> data, TableView table) {
// Adds A Total Row To The Table View & Disables The Sort Policy
double netValueTotal = 0;
double netDelivery = 0.0;
double netOversize = 0.0;
double netDeposit = 0.0;
for (SalesInvoiceNetSale i : data) {
netValueTotal += i.getNetValue();
netDelivery += i.getNetShipping();
netOversize += i.getNetOversize();
netDeposit += i.getNetDeposit();
}
SalesInvoiceNetSaleTotal rowTotal = new SalesInvoiceNetSaleTotal();
rowTotal.setNetValue(netValueTotal);
rowTotal.setNetShipping(netDelivery);
rowTotal.setNetDeposit(netDeposit);
rowTotal.setNetOversize(netOversize);
rowTotal.setLabel("Totals");
data.add(rowTotal);
table.sortPolicyProperty().set(t -> {
Comparator<Row> comparator = (r1, r2)
-> r1 …Run Code Online (Sandbox Code Playgroud) 所以我有一个字符串
2000cc车辆的翻新发动机
我想把它变成
2000CC车辆的翻新发动机
有资本cc在2000CC.我显然不能这样做,text.replaceAll("cc","CC");因为它会用资本版本替换cc的所有出现,所以加速器这个词将成为一个CSelerator.在我的场景中,前四位数字将始终是四位数后跟字母cc,所以我认为这可以用正则表达式来完成.
我的问题是如何在Java中将cc转换为CC,当它跟随4位数并获得我期望的结果时?
String text = text.replaceAll("[0-9]{4}[c]{2}", "?");
Run Code Online (Sandbox Code Playgroud) 我为Magento创建了一个附加模块,它为报价添加了一个自定义总计字段.附加费输入Magento,含税.我已经成功地将模块添加到报价中,并且结帐页面上的总计是正确的.
我的问题出现在尝试对附加费征税时,以便将其纳入并显示在结帐页面的税收字段中.目前它只包含产品税和运费.
我已设法计算附加税的税,但是不能将税收应用于报价,以便它显示在税收领域,但也不认为我的方法也是正确的.任何帮助将非常感激.
class ********_Deposits_Model_Quote_Address_Total_Surcharge extends Mage_Sales_Model_Quote_Address_Total_Abstract {
protected $_config = null;
public function __construct()
{
$this->setCode('surcharge_price');
$this->_config = Mage::getSingleton('tax/config');
$this->_store = Mage::app()->getStore();
}
protected function _calculateTax(Mage_Sales_Model_Quote_Address $address)
{
$calculator = Mage::getSingleton('tax/calculation');
$inclTax = $this->_config->priceIncludesTax($this->_store);
$taxRateRequest = $calculator->getRateRequest(
$address,
$address->getQuote()->getBillingAddress(),
$address->getQuote()->getCustomerTaxClassId(),
$this->_store
);
$taxRateRequest->setProductClassId(Mage::getStoreConfig('********/surcharges/tax_class', $this->_store));
$rate = $calculator->getRate($taxRateRequest);
$baseTax = $tax = $calculator->calcTaxAmount($address->getBaseSurchargePriceAmount(), $rate, $inclTax, true);
}
/**
* Collect address subtotal
*
* @param ********_Surcharges_Model_Quote_Address $address
* @return ********_Surcharges_Model_Quote_Address_Total_Surcharge
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
parent::collect($address);
$this->_setAmount(0)->_setBaseAmount(0);
// If …Run Code Online (Sandbox Code Playgroud) 我有一个表,其中有一个组合单元格,您可以从中为每个行条目选择一个值。问题是,下拉列表仅在编辑单元格时显示,我希望它始终显示在每一行上。这可能吗?如果可能的话,如何实现?
TableColumn<Product, String> actionsCol = new TableColumn<Product, String>("Exception Reason");
actionsCol.setCellValueFactory(new PropertyValueFactory("exceptionReason"));
actionsCol.setCellFactory(ComboBoxTableCell.forTableColumn(exceptionReasons));
actionsCol.setOnEditCommit(
new EventHandler<CellEditEvent<Product, String>>() {
@Override
public void handle(CellEditEvent<Product, String> t) {
((Product) t.getTableView().getItems().get(t.getTablePosition().getRow())).setExceptionReason(t.getNewValue());
};
});
actionsCol.setEditable(true);
Run Code Online (Sandbox Code Playgroud)