我正在尝试将FedEx的跟踪服务集成到我的webapp上,并且我一直收到此错误。
严重程度:FAILURE
来源:prxy
代码:9004
发消息: 远程EJB方法:跟踪未调用。无法创建远程bean。 例外:javax.naming.NamingException:无法找到主要的 代表[root异常是javax.naming.NamingException:无法 找到主要代表]。原因:javax.naming.NamingException: 无法找到主要代表[根异常是 javax.naming.NamingException:无法找到主要代表]
请求
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP- ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://fedex.com/ws/track/v10"><SOAP-ENV:Body><ns1:TrackRequest> <ns1:WebAuthenticationDetail><ns1:ParentCredential><ns1:Key>#########</ns1:Key><ns1:Password>###########</ns1:Password></ns1:ParentCredential><ns1:UserCredential><ns1:Key>#############</ns1:Key><ns1:Password>###########</ns1:Password></ns1:UserCredential></ns1:WebAuthenticationDetail><ns1:ClientDetail><ns1:AccountNumber>#########</ns1:AccountNumber><ns1:MeterNumber>###########</ns1:MeterNumber></ns1:ClientDetail><ns1:TransactionDetail><ns1:CustomerTransactionId>*** Track using PHP ***</ns1:CustomerTransactionId></ns1:TransactionDetail><ns1:Version><ns1:ServiceId>trck</ns1:ServiceId><ns1:Major>10</ns1:Major><ns1:Intermediate>0</ns1:Intermediate><ns1:Minor>0</ns1:Minor></ns1:Version><ns1:SelectionDetails><ns1:PackageIdentifier> <ns1:Type>TRACKING_NUMBER_OR_DOORTAG</ns1:Type><ns1:Value>449044304137821</ns1:Value></ns1:PackageIdentifier><ns1:ShipmentAccountNumber>########</ns1:ShipmentAccountNumber> </ns1:SelectionDetails></ns1:TrackRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>
响应
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><TrackReply xmlns="http://fedex.com/ws/track/v10"><HighestSeverity>FAILURE</HighestSeverity><Notifications><Severity>FAILURE</Severity><Source>prxy</Source><Code>9004</Code><Message>Remote EJB method: track not called. Unable to create the remote bean. Exception: javax.naming.NamingException: unable to find primary representative [Root exception is javax.naming.NamingException: unable to find primary representative]. Cause: javax.naming.NamingException: unable to find primary representative [Root exception is javax.naming.NamingException: unable to find primary representative]</Message></Notifications></TrackReply></SOAP-ENV:Body></SOAP-ENV:Envelope>
我正在使用Laravel框架,有三个文件用于此Fedex集成,即包含XML数据的TrackService_v10.wsdl,TrackWebServiceClient.php5,其中包含发送请求的php函数和fedex-common.php5其中还包含包含要发布的输入的php函数。
我曾尝试在互联网上寻找各地以及FedEx上的开发人员和资源中心,但我真的无法让它发挥作用。我也不理解这个SOAP请求。此外,FedEx表示他们没有程序员来帮助我。有人可以帮忙吗?提前谢谢。
答案 0 :(得分:1)
我一直有同样的问题。在我的桌子上敲了几个小时之后,我发现了这篇文章 - https://stackoverflow.com/a/10941234/5632365。它属于WSDL文件的v5(当前为10),但基本上你需要删除&#34; beta&#34;来自第2296行的网址。
<service name="TrackService">
<port name="TrackServicePort" binding="ns:TrackServiceSoapBinding">
<s1:address location="https://wsbeta.fedex.com:443/web-services/track"/>
</port>
</service>
应该是
<service name="TrackService">
<port name="TrackServicePort" binding="ns:TrackServiceSoapBinding">
<s1:address location="https://ws.fedex.com:443/web-services/track"/>
</port>
</service>
神奇地,一切都将(应该)开始起作用。希望这对你有所帮助!
答案 1 :(得分:0)
删除private void popupWindow() {
LayoutInflater layoutInflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View popupView = layoutInflater.inflate(R.layout.activity_difficulty, null);
popupView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
final PopupWindow popupWindow = new PopupWindow(popupView, popupView.getMeasuredWidth(), popupView.getMeasuredHeight(), true);
popupWindow.showAtLocation(popupView, Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL, 0, 0);
popupWindow.setOutsideTouchable(true);
popupWindow.setIgnoreCheekPress();
Button btnOk = (Button) popupView.findViewById(R.id.btnok);
Button btnCancel = (Button) popupView.findViewById(R.id.btncancel);
mMode = (RadioGroup) popupView.findViewById(R.id.radioScreenMode);
mMode.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
switch (mMode.getCheckedRadioButtonId()) {
case R.id.radioeasy:
Toast.makeText(getApplicationContext(), "Easy Mode is selected", Toast.LENGTH_SHORT).show();
break;
case R.id.radionormal:
Toast.makeText(getApplicationContext(), "Normal Mode is selected", Toast.LENGTH_SHORT).show();
break;
case R.id.radiohard:
Toast.makeText(getApplicationContext(), "Hard Mode is selected", Toast.LENGTH_SHORT).show();
break;
default:
break;
}
}
});
btnOk.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
popupWindow.dismiss();
}
});
btnCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
popupWindow.dismiss();
}
});
}
似乎不再是一个好的解决方案。
我一直在与Fedex支持部门联系,当您设置无效的“ ParentCredentials”时,实际上就出现了问题。
就我而言,我只需要使用“ UserCredentials”,如果Fedex提供的(Java)示例中的“ ParentCredentials”为空,则将其设置为“ XXX”。