[英]How to pass through the soap memory stream?
我創建 memory stream。
var memoryStream = new MemoryStream();
var binaryFormatter = new BinaryFormatter();
binaryFormatter.Serialize(memoryStream, list.ToArray());
我需要通過 soap 到 java 服務器並插入數據庫。
以及如何創建 webService 方法?
@WebMethod(operationName = "CreateObject")
public String CreateTopology(
@WebParam(name = "session")int id_session,
@WebParam(name = "title") String title,
@WebParam(name = "content") Object content,
@WebParam(name = "access") Integer access) {
編輯:問題。 我在 C # 中序列化了 object。 我需要通過 SOAP Java 將其傳遞到服務器,然后將其保存在 MySQL 數據庫中的 Blob 類型字段中(可能不是 blob)
看看這里:
//build a Call object
Call call = new Call();
call.setTargetObjectURI("urn:greetingService");
call.setMethodName("sayGreeting");
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
//creating a parameter list
Vector params = new Vector();
params.addElement(new Parameter("name", String.class, name,null));
//adding the parameter(s) to the Call object
call.setParams(params);
您正在設置方法名稱“sayGreeting”,並在向量參數中指定將調用該方法的參數。 這個參數向量就是你需要的!
代碼示例取自本教程的第 2 頁,我非常推薦: http://javaboutique.internet.com/tutorials/SOAP/
base64String - 作為字符串傳遞
var memoryStream = new MemoryStream();
var binaryFormatter = new BinaryFormatter();
binaryFormatter.Serialize(memoryStream, m_workspace.ListPlatforms.ToArray());
String base64String = Convert.ToBase64String(memoryStream.ToArray());
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.