本文整理汇总了Java中org.ksoap2.transport.HttpResponseException类的典型用法代码示例。如果您正苦于以下问题:Java HttpResponseException类的具体用法?Java HttpResponseException怎么用?Java HttpResponseException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HttpResponseException类属于org.ksoap2.transport包,在下文中一共展示了HttpResponseException类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getWSResponse
import org.ksoap2.transport.HttpResponseException; //导入依赖的package包/类
Komunikat getWSResponse(String code, String soapAction, String methodName, String outerBox)
throws HttpResponseException, IOException, XmlPullParserException{
//create envelope
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.implicitTypes=false;
addSecurityHeader(envelope);
addMappings(envelope, outerBox);
envelope.setOutputSoapObject(createRequestParameter(code, methodName));
//WS call
HttpTransportSE transport = new HttpTransportSE(URL);
transport.debug = true;
// try{
transport.call(soapAction, envelope);
// }catch(Exception e){
// e.printStackTrace();
// }
WSResponse response = (WSResponse) envelope.bodyIn;
return response.getKomunikat();
}
示例2: soap
import org.ksoap2.transport.HttpResponseException; //导入依赖的package包/类
public Vector<?> soap(HttpServletRequest req) throws JSONException,
IOException {
JSONObject json = new JSONObject(IO.read(req));
// TODO: Route to SOAP ...
String action = req.getAttribute(Route.ACTION).toString();
if (action == null) {
throw new JSONException("Missing SOAP action.");
}
final Route route = router.route(action);
if (route == null) {
throw new JSONException("Not support action:" + action);
}
final SoapObject so = new SoapObject(route.getNameSpace(),
route.getAction());
Envelope envelope = createEnvelope(so, IO.toElement(json, route.getNameSpace(),
route.getAction()));
KXmlSerializer xmlWriter = new KXmlSerializer();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
xmlWriter.setOutput(outputStream, "UTF-8");
envelope.write(xmlWriter);
xmlWriter.flush();
Logger.getLogger(Soaper.class.getName()).info(outputStream.toString());
HttpTransportSE ht = getHttpTransportSE(route.getSoapUrl());
try {
ht.call(so.getName(), envelope);
Vector<?> ro = (Vector<?>) envelope.getResponse();
return ro;
} catch (HttpResponseException | XmlPullParserException | SoapFault e) {
throw new JSONException(e);
}
}
示例3: getPrzesylka
import org.ksoap2.transport.HttpResponseException; //导入依赖的package包/类
public Komunikat getPrzesylka(String code)
throws HttpResponseException, IOException, XmlPullParserException{
return getWSResponse(code, SOAP_ACTION, METHOD_NAME, RESPONSE_OUTER_BOX);
}
示例4: getPrzesylkaEx
import org.ksoap2.transport.HttpResponseException; //导入依赖的package包/类
public Komunikat getPrzesylkaEx(String code)
throws HttpResponseException, IOException, XmlPullParserException{
return getWSResponse(code, SOAP_ACTION_EX, METHOD_NAME_EX, RESPONSE_OUTER_BOX_EX);
}