2 fengfuyudi fengfuyudi 于 2013.08.17 10:44 提问

soap连接出现415错误,请大家帮忙解决一下,我初次接触soap,这是代码

package com.xmobo.mapp.jkdy.myjk;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import com.xmobo.mapp.jkdy.util.CommunicateUtil;
import com.xmobo.mapp.jkdy.util.JsonUtils;
import com.xmobo.mapp.jkdy.util.SubServerOrder;
import com.xmobo.mapp.jkdy.util.Tools;

public class myAreas {

public static Map<String, String> getLogin(String url,String sendXml)throws Exception{
String xmlstr=CommunicateUtil.get(url,sendXml);
//System.out.println(xmlstr);
Map<String,String> re_login=new HashMap<String,String>();
re_login=Tools.xmltoHashMap(xmlstr);//解析xml出数据
//System.out.println(re_login);
return re_login;


}
public static void main(String[] args) throws Exception {
    String str="<?xml version=\"1.0\" encoding=\"utf-8\"?>"+
    "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"+
    "<soap:Body>"+"<GetArea xmlns=\"ForSzMobile\">"+
    "<province>湖北</province>"+"</GetArea>"+
    "</soap:Body>"+
    "</soap:Envelope>"; 
    System.out.println(str);
    Map<String,String> re_login=new HashMap<String,String>();
    re_login=myAreas.getLogin( "http://61.4.83.228:87/forsz/forszmobile.asmx",str);
    System.out.println(re_login);
}

}

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!